Построение петли гистерезиса с помощью jFreeChart

Мне нужно нарисовать петли гистерезиса, а затем рассчитать площадь, замкнутую внутри петли. Я использую jFreeChart.

рассмотрим следующие данные:

 hyst[0]=0;
       hyst[1]=0;
       hyst[2]=0.0098;
       hyst[3]=0.0196;
       hyst[4]=0.0489;
       hyst[5]=0.0879;
       hyst[6]=0.0684;
       hyst[7]=0.0489;
       hyst[8]=0.0196;
       hyst[9]=0.0098;
       hyst[10]=0;
       hyst[11]=0;
       hyst[12]=0;
       hyst[13]=0;
       hyst[14]=0;
       hyst[15]=-0.0195;
       hyst[16]=-0.0488;
       hyst[17]=-0.0391;
       hyst[18]=-0.0195;
       hyst[19]=0;
       hyst[20]=0;

Когда я пытаюсь:

   public void plotHysteresis()
   {
       int j=0;
       int i=0;
       XYSeries series1 = new XYSeries("Before Treatment");
      // DefaultCategoryDataset series1 = new DefaultCategoryDataset();
       for(i=0;i<6;i++)
       {    
        series1.add(j,hyst[i]);
        logTextArea.append(Integer.toString(j) +" : " +Double.toString(hyst[i])+"\n");
        j=j+5;
       }
       j=j-5; 
       for(;i<11;i++)
       {
        j=j-5;   
        series1.add(j,hyst[i]);
        logTextArea.append(Integer.toString(j) +" : " +Double.toString(hyst[i])+"\n");
       }
        for(;i<16;i++)
       {
        j=j-5;   
        series1.add(j,hyst[i]);
        logTextArea.append(Integer.toString(j) +" : " +Double.toString(hyst[i])+"\n");
       }
           for(;i<21;i++)
       {
        j=j+5;   
        series1.add(j,hyst[i]);
        logTextArea.append(Integer.toString(j) +" : " +Double.toString(hyst[i])+"\n");
       }

    XYSeriesCollection dataset = new XYSeriesCollection();
    dataset.addSeries(series1);

    JFreeChart chart = ChartFactory.createXYAreaChart(
"Hysteresis Plot", // chart title
"Pounds (lb)", // x axis label
"Distance (inches)", // y axis label
dataset, // data
PlotOrientation.VERTICAL,
true, // include legend
true, // tooltips
false // urls
);
    chart.setBackgroundPaint(Color.white);

    ChartPanel frame = new ChartPanel(chart);
    frame.setVisible(true);
    frame.setSize(plotPanel.getWidth(),plotPanel.getHeight());
    plotPanel.add(frame);
    plotPanel.repaint();
   }

Это дает мне результат ниже:

Если я использую:

 JFreeChart chart = ChartFactory.createXYLineChart(
"Hysteresis Plot", // chart title
"Pounds (lb)", // x axis label
"Distance (inches)", // y axis label
dataset, // data
PlotOrientation.VERTICAL,
true, // include legend
true, // tooltips
false // urls
);

Я даю:

Мне нужен график гистерезиса, который выглядит так:

Я думаю, что разница в способе соединения точек. Пожалуйста, объясните, как получить желаемую петлю гистерезиса с помощью jFreeChart, а затем, как рассчитать площадь, вложенную.

Спасибо

Ответы на вопрос(1)

Ваш ответ на вопрос