Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java jfreechart,图表创建错误_Java_Jsp_Jfreechart - Fatal编程技术网

Java jfreechart,图表创建错误

Java jfreechart,图表创建错误,java,jsp,jfreechart,Java,Jsp,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, S

这对你们来说可能是个愚蠢的问题,但我有以下错误。我认为
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:        
编辑感谢您的回复

但如果我删除PlotOrientation,我会得到

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);
            }
         }
DefaultCategoryDataset hourlydata=新建DefaultCategoryDataset();

对于(int k=1;k关于该错误,您正在尝试使用PlotOrientation参数调用
createLineChart
方法。该方法没有此参数


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

也许您应该尝试将代码放入java类中,只是为了调试。这样可以更容易地跟踪错误。我们可以看到声明、初始化和填充
CategoryDataset
的代码吗?另外,尝试删除
PlotOrientation.HORIZONTAL
,看看这是否有帮助s