0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

JFreeChart-PolarChart-極座標-UIで特定データを強調する

Posted at

目次 ⇒ JFreeChartサンプル

package jp.avaj.lib.chart;

import org.jfree.chart.ChartFrame;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.axis.NumberAxis;
import org.jfree.chart.axis.ValueAxis;
import org.jfree.chart.plot.Plot;
import org.jfree.chart.plot.PolarPlot;
import org.jfree.chart.renderer.DefaultPolarItemRenderer;
import org.jfree.chart.renderer.PolarItemRenderer;
import org.jfree.data.xy.XYDataset;
import org.jfree.data.xy.XYSeries;
import org.jfree.data.xy.XYSeriesCollection;

/**
■ JFreeChart-PolarChart-極座標-UIで特定データを強調する

・ArcPolarChartEmphasizeWinを使用するとデータ選択の画面が表示される.
・ボタンを押下すると、当該データが強調表示される.

・(1)データセットはXYSeriesCollectionを使う.
・(2)データには角度と値を指定する.
  ・角度はラジアンではなく度.
・(3)レンダラはDefaultPolarItemRenderer.
・軸は一つだけ必要で、NumberAxisを指定した.
・プロットはPolarPlotというものがあるので、これを使う.

 */
public class Chart20_02 {
  // PolarChar/極座標.
  A_Chart20 a_Chart20;
  // 目次-Artery-JFreeChart用のライブラリ
  A_Chart00 a_LibChartSampeContents;

  public static void main(String[] args) {
    XYSeriesCollection dataset = new XYSeriesCollection(); // (1)
    XYSeries data0 = new XYSeries("data0");
    data0.add(0.0D, 2.0D); // (2)
    data0.add(90.0D, 13.0D);
    data0.add(180.0D, 9.0D);
    data0.add(270.0D, 8.0D);
    dataset.addSeries(data0);
    XYSeries data1 = new XYSeries("data1");
     data1.add(90.0D, 0.0D);
    data1.add(180.0D, 22.0D);
    data1.add(250.0D, 18.0D);
    data1.add(355.0D, 10.9D);
    dataset.addSeries(data1);
    //
    DefaultPolarItemRenderer renderer = new DefaultPolarItemRenderer(); // (3)
    NumberAxis radiusAxis = new NumberAxis(); //(4)
    PolarPlot polarPlot = new PolarPlot((XYDataset)dataset,(ValueAxis)radiusAxis,(PolarItemRenderer)renderer);
    JFreeChart jfreeChart = new JFreeChart("PolerPlot",(Plot)polarPlot);
    //
    ChartFrame cFrame = new ChartFrame("PolerPlot",(JFreeChart)jfreeChart);
    cFrame.pack();
    cFrame.setVisible(true);
    //
    new ArcPolarChartEmphasizeWin(cFrame,polarPlot,dataset);
  }
}

無題.png

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?