user1516649
user1516649

Reputation: 155

jfreechart, chart creation error

This may be a dumb question to you guys, but I am having the following error. I think all the parameters for createLineChart are correct. I have no idea why it is saying that I'm wrong... Can you please tell me why I am getting this error?

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:        

EDIT Thanks for the responses!

But if I delete PlotOrientation, i get

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

Initialization:

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

I somehow figured out this problems by importing bunch of library :/ Thanks for your help!

Upvotes: 2

Views: 527

Answers (1)

mkhelif
mkhelif

Reputation: 1559

Regarding to the error, you are trying to invoke the createLineChart method with a PlotOrientation parameter. The method does not have this parameter.

Maybe this is not the method you want to invoke.

Upvotes: 1

Related Questions