1

ヒステリシス ループを描画し、ループ内で閉じた領域を計算する必要があります。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 で目的のヒステリシス ループを取得する方法と、囲まれた面積を計算する方法をガイドしてください。

ありがとう

4

1 に答える 1

1

線の色とデータ ポイントを表す記号を変更するにはどうすればよいですか。全部統一してほしい。

JFreeChartあなたはあなたの見解に落ち着いたようです。他のいくつかのコメントを総合すると、

  • DrawingSupplierここで提案され、ここに示されているように、を提供することで、いくつかのシリーズの色と形を均一にすることができます

  • シリーズを に結合して、ここでGeneralPath概説されているように面積を見積もることができます。

于 2013-02-19T20:53:53.963 に答える