【问题标题】:JFreeChart implementation errorJFreeChart 实现错误
【发布时间】:2013-04-05 17:55:18
【问题描述】:
import java.io.*;
import org.jfree.data.category.DefaultCategoryDataset;
import org.jfree.chart.ChartFactory; 
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.chart.JFreeChart; 
import org.jfree.chart.ChartUtilities; 
public class xyLine {  
      public static void main(String[] args){
         try {

                /* Step - 1: Define the data for the line chart  */
                DefaultCategoryDataset line_chart_dataset = new DefaultCategoryDataset();
                line_chart_dataset.addValue(15, "schools", "1970");
                line_chart_dataset.addValue(30, "schools", "1980");
                line_chart_dataset.addValue(60, "schools", "1990");
                line_chart_dataset.addValue(120, "schools", "2000");
                line_chart_dataset.addValue(240, "schools", "2010");                

                /* Step -2:Define the JFreeChart object to create line chart */
                JFreeChart lineChartObject=ChartFactory.createLineChart("Schools Vs Years","Year","Schools Count",line_chart_dataset,PlotOrientation.VERTICAL,true,true,false);                

                /* Step -3 : Write line chart to a file */               
                 int width=640; /* Width of the image */
                 int height=480; /* Height of the image */                
                 File lineChart=new File("line_Chart_example.png");              
                 ChartUtilities.saveChartAsPNG(lineChart,lineChartObject,width,height); 
         }
         catch (Exception i)
         {
             System.out.println(i);
         }
     }
 }

我正在创建一个带有点的折线图。导致问题的行如下... JFreeChart lineChartObject=ChartFactory.createLineChart("Schools Vs Years","Year","Schools Count",line_chart_dataset,PlotOrientation.VERTICAL,true,true,false);

错误是:org.jfree.util.PublicCloneable 类型无法解析。它是从所需的 .class 文件中间接引用的

我已尝试添加 jar 文件(jfreechart-1.0.14.jar),但仍然无法正常工作。任何有任何帮助的人都将不胜感激。

【问题讨论】:

  • 您可能想购买开发者指南。

标签: java jfreechart


【解决方案1】:

您还需要jcommon-1.0.14.jar。请参阅Downloading JFreeChart 了解更多信息。

【讨论】:

    猜你喜欢
    • 2011-09-03
    • 2023-04-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-10-23
    • 1970-01-01
    • 2018-05-26
    相关资源
    最近更新 更多