I'm using strut2
with JFReeChart
1.0.13
And some reason a i can't use ChartUtilities.apply CurrentTheme
.
The libraray is imported.
I want to try one of the example.
but it makes exception:
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Thread.java:722) Caused by: java.lang.NoSuchMethodError: org.jfree.chart.ChartUtilities.applyCurrentTheme(Lorg/jfree/chart/JFreeChart;)V
at
I try to use public static ChartTheme getChartTheme()
but the same result
private static JFreeChart createChart(CategoryDataset categorydataset)
{
JFreeChart jfreechart = ChartFactory.createBarChart("Open Source Projects By Licence", "Licence", "Project Count", categorydataset, PlotOrientation.HORIZONTAL, false, true, false);
TextTitle texttitle = new TextTitle("Source: Freshmeat (http://www.freshmeat.net/)", new Font("Dialog", 0, 10));
texttitle.setPosition(RectangleEdge.BOTTOM);
jfreechart.addSubtitle(texttitle);
**ChartUtilities.applyCurrentTheme(jfreechart);**
CategoryPlot categoryplot = (CategoryPlot)jfreechart.getPlot();
categoryplot.setDomainGridlinesVisible(true);
categoryplot.getDomainAxis().setMaximumCategoryLabelWidthRatio(0.8F);
NumberAxis numberaxis = (NumberAxis)categoryplot.getRangeAxis();
numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
BarRenderer barrenderer = (BarRenderer)categoryplot.getRenderer();
barrenderer.setDrawBarOutline(false);
StandardCategoryToolTipGenerator standardcategorytooltipgenerator = new StandardCategoryToolTipGenerator("{1}: {2} projects", new DecimalFormat("0"));
barrenderer.setBaseToolTipGenerator(standardcategorytooltipgenerator);
GradientPaint gradientpaint = new GradientPaint(0.0F, 0.0F, Color.blue, 0.0F, 0.0F, new Color(0, 0, 64));
barrenderer.setSeriesPaint(0, gradientpaint);
return jfreechart;
}
How can it solved this problem?
If i comment this line then is no error, but the chart is not good.
Edit:
I upgrage the version to 1.0.15 as Roman C sugested After that the problem is fixed.