stinus Posted November 29, 2011 Share Posted November 29, 2011 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 More sharing options...
stinus Posted November 30, 2011 Author Share Posted November 30, 2011 Ignore this post please, the problem was on the backend, not in the report. When a value is null, the line is just disrupted and that 's ok. Link to comment Share on other sites More sharing options...
iamwoodyjones Posted December 2, 2011 Share Posted December 2, 2011 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now