0
1

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-レーダーチャート(SpiderWebChart)-ArMatrixからCategoryDatasetを作成

Posted at

目次 ⇒ JFreeChartサンプル

package jp.avaj.lib.chart;

import org.jfree.chart.ChartFrame;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.Plot;
import org.jfree.chart.plot.SpiderWebPlot;
import org.jfree.data.category.CategoryDataset;
import org.jfree.data.category.DefaultCategoryDataset;

import jp.avaj.lib.algo.ArMatrix;

/**
■ JFreeChart-レーダーチャート(SpiderWebChart)-ArMatrixからCategoryDatasetを作成

 */
public class Chart06_01 {
  // 目次-レーダーチャート(SpiderWebChart)
  A_Chart06 a_Chart06;
  // 目次-Artery-JFreeChart用のライブラリ
  A_Chart00 a_LibChartSampeContents;

  /** 成績のレーダーチャートを作成する */
  public static void main(String[] args) {
    // レーダーチャート(SpiderWebChart)にはCategoryDatasetを使用する
	// CategoryDatasetの作成方法は、以下を参照
    Chart01_CategoryDataset_2 categoryDataSetSample;
    // ここではArMatrixからCategoryDatasetを作成する
    DefaultCategoryDataset dataset;
    {
      ArMatrix<String,String,Integer> mat = new ArMatrix();
      // Aの成績⇒理系が得意
      mat.put("A","英語",70);
      mat.put("A","数学",90);
      mat.put("A","国語",55);
      mat.put("A","理科",95);
      mat.put("A","社会",45);
      // Bの成績⇒文系が得意
      mat.put("B","英語",100);
      mat.put("B","数学",60);
      mat.put("B","国語",80);
      mat.put("B","理科",55);
      mat.put("B","社会",70);
      // Cの成績
      mat.put("C","英語",70);
      mat.put("C","数学",70);
      mat.put("C","国語",70);
      mat.put("C","理科",70);
      mat.put("C","社会",70);
      //
      dataset = ArcDefaultCategoryDataset.create(mat,null,null);
    }
    // SpiderWebPlotはRenderer,Axisは指定する必要がない
    SpiderWebPlot spiderWebPlot = new SpiderWebPlot((CategoryDataset)dataset);
    // チャートを表示する
    JFreeChart jfreeChart = new JFreeChart("成績レーダーチャート",(Plot)spiderWebPlot);
    ChartFrame cFrame = new ChartFrame("RadarChartFrame",(JFreeChart)jfreeChart);
    cFrame.pack();
    cFrame.setVisible(true);
  }
}

無題.png

0
1
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
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?