Java ChartUtilities.apply CurrentTheme生成NoSuchMethodError
我在JFReeChart 1.0.13中使用strut2 由于某种原因,我不能使用ChartUtilities.apply CurrentTheme。 库光线是导入的 我想试试下面的一个例子 但也有例外: org.apache.tomcat.util.net.JIoEndpoint$Worker.runJIoEndpoint.java:489 at java.lang.Thread.runThread.java:722由以下原因引起:java.lang.NoSuchMethodError:org.jfree.chart.ChartUtilities.applycurrentThemeLog/jfree/chart/JFreeChart;V在 我尝试使用公共静态ChartTheme getChartTheme,但结果相同Java ChartUtilities.apply CurrentTheme生成NoSuchMethodError,java,struts2,jfreechart,Java,Struts2,Jfreechart,我在JFReeChart 1.0.13中使用strut2 由于某种原因,我不能使用ChartUtilities.apply CurrentTheme。 库光线是导入的 我想试试下面的一个例子 但也有例外: org.apache.tomcat.util.net.JIoEndpoint$Worker.runJIoEndpoint.java:489 at java.lang.Thread.runThread.java:722由以下原因引起:java.lang.NoSuchMethodError:org
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;
}
如何解决这个问题?
如果我评论这一行,那么没有错误,但图表不好
编辑:
我将版本升级到1.0.15,正如罗马C所建议的那样
之后问题就解决了