How do I define a trend line for the charts created against the JFreeChart library?
There is a way to achieve this through a bit of customization in JFreeChart. A trend line can be customized in JFreeCharts (v.1.0.7 or more) for charts based on an XYPlot.
For this plot type you can add a second renderer, customized in order to draw a trend line. This renderer could be, for example, an org.jfree.chart.renderer.xy.XYSplineRenderer.
In order to make it functional, you have to add a second dataset to the xyPlot element, containing the appropriate data to be represented by the trend line.
For more info, you could take a look at this discussion: http://www.jfree.org/phpBB2/viewtopic.php?f=3&t=29883&p=82403&hilit=trend+line#p82403
Attached is a customizer class that can be put into the JasperReports Library charts sample src directory, and you can apply it to the XYBarChart sample. Please find in attachment both the XyBarChartCustomizer java file and the generated XYBarChart pdf file.
Recommended Comments
There are no comments to display.