ChartUtilities.apply当前主题制作NoSuchMethodError

时间:2013-09-05 14:28:07

标签: java struts2 jfreechart

我正在strut2使用JFReeChart 1.0.13

有些原因我无法使用ChartUtilities.apply CurrentTheme。 图书馆是导入的。

我想尝试一个例子。

但它有例外:

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

我尝试使用public static ChartTheme getChartTheme()但结果相同

    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;
}

它如何解决这个问题?

如果我评论这一行,那么没有错误,但图表不好。

编辑:

当罗马C消化时,我将版本升级到1.0.15 之后问题就解决了。

0 个答案:

没有答案