Jump to content
We've recently updated our Privacy Statement, available here ×

No line in chart when one value is null ?


stinus

Recommended Posts

When one valueExp is null  , the line of the chart is not shown... is this normal ?

<subDataset name="PerformanceChartDataSet">
        <field name="timestamp" class="java.util.Date"/>
        <field name="valueExp" class="java.lang.Double"/>
    </subDataset>

<parameter name="PerformanceDataSourceChart" class="net.sf.jasperreports.engine.data.JRBeanCollectionDataSource"/>

<timeSeriesChart>
                            <chart>
                                <reportElement positionType="Float" x="0" y="25" width="270" height="175" backcolor="#FFFFFF"/>
                                <chartTitle color="#000000"/>
                                <chartSubtitle color="#000000"/>
                                <chartLegend textColor="#000000" backgroundColor="#FFFFFF"/>
                            </chart>
                            <timeSeriesDataset timePeriod="Month">
                                <dataset>
                                    <datasetRun subDataset="PerformanceChartDataSet">
                                        <dataSourceExpression><![CDATA[$P{PerformanceDataSourceChart}]]></dataSourceExpression>
                                    </datasetRun>
                                </dataset>
                                <timeSeries>
                                    <seriesExpression><![CDATA["Expected PR"]]></seriesExpression>
                                    <timePeriodExpression><![CDATA[$F{timestamp}]]></timePeriodExpression>
                                    <valueExpression><![CDATA[$F{valueExp}]]></valueExpression>
                                </timeSeries>
                            </timeSeriesDataset>
                            <timeSeriesPlot isShowLines="true" isShowShapes="true">
                                <plot>
                                    <seriesColor seriesOrder="0" color="#CA3419"/>
                                    <seriesColor seriesOrder="1" color="#862311"/>
                                </plot>
                            </timeSeriesPlot>
                        </timeSeriesChart>

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Nice of you coming back and posting an update.  Not a lot of people do that.  Bumping your karma one.  Also, sometimes I use an expression to check for null and if a value within a chart is null I then give a default value of something like 0.  Something like this:

$F{valueExp} == null ? 0 : $F{valueExp}

That helped me out a lot with charts.  I'll run it and everything runs fine, and then one day there's a null value and the whole report blows up until I go back and put in that null check.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...