How to plot multiple series with javafx line chart which is in array list

前端 未结 1 782
醉话见心
醉话见心 2021-01-27 11:15

There is no error but there is an issue with the plot am not getting the correct line chart plot, I want parameters in the x-axis and values in the y-axis but I have 3 engines a

相关标签:
1条回答
  • 2021-01-27 11:56

    Change the generateChart of performance class

    public void generateChart() {
        for (int i = 0; i < engines.size(); i++) {
            XYChart.Series series = new XYChart.Series();
            series.setName(engines.get(i).toString());
            for (int j = 0; j < parameters.size(); j++) {
                series.getData().add(new XYChart.Data(parameters.get(j).toString(), param.get(i).get(j)));
            }
            lineChart.getData().add(series);
        }
        System.out.println(lineChart);
    }
    

    And Use the class from the start method of NewFXMain class like below and remove the for loop

    performance performvalues = new performance(lineChart, parameters, finalValue, engines);
    performvalues.generateChart();
    

    Note : Always keep the class name CamelCase

    0 讨论(0)
提交回复
热议问题