这对你们来说可能是一个愚蠢的问题,但我有以下错误。我认为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);
}
}
我通过导入一堆库来解决这个问题:/感谢您的帮助!
答案 0 :(得分:1)
关于错误,您尝试使用PlotOrientation参数调用createLineChart
方法。该方法没有此参数。
也许这不是您想要调用的方法。