JFREECHART,图表创建错误



这对你们来说可能是一个愚蠢的问题,但是我有以下错误。我认为createLineChart的所有参数都是正确的。我不知道为什么说我错了...您能告诉我为什么我会遇到这个错误吗?

org.apache.jasper.JasperException: Unable to compile class for JSP: 
An error occurred at line: 102 in the jsp file: /graph.jsp
The method createLineChart(String, String, String, CategoryDataset, boolean, boolean, boolean) in the type ChartFactory is not applicable for the arguments (String, String, String, DefaultCategoryDataset, PlotOrientation, boolean, boolean, boolean)
99:          }
100:         
101:         
102:         JFreeChart chart = ChartFactory.createLineChart("Houlry", "Usage", "time", hourlydata , PlotOrientation.HORIZONTAL, true, true, false);
103:        

编辑感谢您的回复!

但是,如果我删除了绘图取向,我会得到

method createLineChart n class org.jfree.jfreechartChartFactory cannot be applied to given types;
required java.lang.String,java.langString,java.langString,org.jfree.data.category.CategoryDataset,org.jfree.chart.plot.PlotOrientatio,boolean,boolean boolean

初始化:

DefaultCategoryDataset hourlydata = new DefaultCategoryDataset();
for (int k = 1; k <= i; k++) {
        if (k == 1){
           label = "CPU Average";
        }
        if (k == 2){
            label = "CPU Max";
        }
        if (k == 3){
            label = "RAM Average";
        }
        if (k == 4){
            label = "RAM Max";
        }
        for (int j = 1; j < 7; j++) {
            if (j == 1){
                time = "10";
            }
            if (j == 2){
                time = "20";
            }
            if (j == 3){
                time = "30";
            }
            if (j == 4){
                time = "40";
            }
            if (j == 5){
                time = "50";
            }
            if (j == 6){
                time = "60";
            }
            hourlydata.addValue(arr[k][j], label, time);
            }
         }

我以某种方式通过导入一堆图书馆来解决这个问题:/感谢您的帮助!

涉及到错误,您正在尝试使用plotorientation参数调用createLineChart方法。该方法没有此参数。

也许这不是您要调用的方法。

最新更新