use of org.jfree.chart.plot.PiePlot in project MtgDesktopCompanion by nicho92.
the class RarityRepartitionPanel method refresh.
private void refresh() {
this.removeAll();
JFreeChart chart = ChartFactory.createPieChart3D(// chart title
"Rarity repartition", // data
getRarityRepartitionDataSet(), // include legend
false, true, true);
pane = new ChartPanel(chart);
PiePlot plot = (PiePlot) chart.getPlot();
plot.setSectionPaint("Uncommon", Color.GRAY);
plot.setSectionPaint("Common", Color.WHITE);
plot.setSectionPaint("Rare", Color.YELLOW);
plot.setSectionPaint("Mythic Rare", Color.ORANGE);
PieSectionLabelGenerator generator = new StandardPieSectionLabelGenerator("{0} = {1}", new DecimalFormat("0"), new DecimalFormat("0.00%"));
plot.setLabelGenerator(generator);
this.add(pane, BorderLayout.CENTER);
}
use of org.jfree.chart.plot.PiePlot in project MtgDesktopCompanion by nicho92.
the class TypeRepartitionPanel method refresh.
private void refresh() {
this.removeAll();
JFreeChart chart = ChartFactory.createPieChart3D(// chart title
"Type repartition", // data
getTypeRepartitionDataSet(), // include legend
false, true, true);
pane = new ChartPanel(chart);
PiePlot plot = (PiePlot) chart.getPlot();
plot.setSectionPaint("B", Color.BLACK);
plot.setSectionPaint("W", Color.WHITE);
plot.setSectionPaint("U", Color.BLUE);
plot.setSectionPaint("G", Color.GREEN);
plot.setSectionPaint("R", Color.RED);
plot.setSectionPaint("multi", Color.YELLOW);
plot.setSectionPaint("uncolor", Color.GRAY);
PieSectionLabelGenerator generator = new StandardPieSectionLabelGenerator("{0} = {1}", new DecimalFormat("0"), new DecimalFormat("0.00%"));
plot.setLabelGenerator(generator);
this.add(pane, BorderLayout.CENTER);
}
use of org.jfree.chart.plot.PiePlot in project eclipse-cs by checkstyle.
the class GraphStatsView method createChart.
/**
* Crée le graphe JFreeChart.
*
* @param piedataset
* : la source de données à afficher
* @return le diagramme
*/
private JFreeChart createChart(GraphPieDataset piedataset) {
JFreeChart jfreechart = ChartFactory.createPieChart3D(null, piedataset, false, true, false);
jfreechart.setAntiAlias(true);
jfreechart.setTextAntiAlias(true);
PiePlot pieplot3d = (PiePlot) jfreechart.getPlot();
pieplot3d.setInsets(new RectangleInsets(0, 0, 0, 0));
final double angle = 290D;
pieplot3d.setStartAngle(angle);
pieplot3d.setDirection(Rotation.CLOCKWISE);
final float foreground = 0.5F;
pieplot3d.setForegroundAlpha(foreground);
pieplot3d.setNoDataMessage(Messages.GraphStatsView_noDataToDisplay);
pieplot3d.setCircular(true);
pieplot3d.setOutlinePaint(null);
pieplot3d.setLabelFont(new Font("SansSerif", Font.PLAIN, 10));
pieplot3d.setLabelGap(0.02);
pieplot3d.setLabelOutlinePaint(null);
pieplot3d.setLabelShadowPaint(null);
pieplot3d.setLabelBackgroundPaint(Color.WHITE);
pieplot3d.setBackgroundPaint(Color.WHITE);
pieplot3d.setInteriorGap(0.02);
pieplot3d.setMaximumLabelWidth(0.20);
return jfreechart;
}
use of org.jfree.chart.plot.PiePlot in project MassBank-web by MassBank.
the class Contents method drawDataset.
private static JFreeChart drawDataset(PieDataset dataset, String title) {
// JFreeChartオブジェクト生成
JFreeChart chart = ChartFactory.createPieChart(title, dataset, true, true, false);
// グラフ全体背景色設定
chart.setBackgroundPaint(new ChartColor(242, 246, 255));
// グラフ全体境界線設定
chart.setBorderVisible(true);
// グラフエリアパディング設定
chart.setPadding(new RectangleInsets(10, 10, 10, 10));
// グラフタイトルフォント設定
chart.getTitle().setFont(new Font("Arial", Font.BOLD, 22));
// 凡例の表示位置設定
LegendTitle legend = chart.getLegend();
legend.setPosition(RectangleEdge.RIGHT);
// 凡例パディング設定
legend.setPadding(10, 10, 10, 10);
// 凡例マージン設定
legend.setMargin(0, 10, 0, 5);
// 凡例表示位置上寄せ
legend.setVerticalAlignment(VerticalAlignment.TOP);
// グラフの描画領域を取得
PiePlot plot = (PiePlot) chart.getPlot();
// グラフの楕円表示を許可する
plot.setCircular(true);
// グラフ境界線色設定
plot.setDefaultSectionOutlinePaint(ChartColor.BLACK);
// グラフラベル背景色設定
plot.setLabelBackgroundPaint(new Color(240, 255, 255));
// グラフラベルフォント設定
plot.setLabelFont(new Font("Arial", Font.PLAIN, 12));
// グラフラベル幅設定
plot.setMaximumLabelWidth(0.3);
// グラフラベル間距離設定
plot.setLabelGap(0.05);
// グラフ前景色透明度設定
plot.setForegroundAlpha(0.9f);
return chart;
}
use of org.jfree.chart.plot.PiePlot in project SIMVA-SoS by SESoS.
the class JFreeChartTest method testEquals2.
/**
* A test to make sure that the legend is being picked up in the
* equals() testing.
*/
@Test
public void testEquals2() {
JFreeChart chart1 = new JFreeChart("Title", new Font("SansSerif", Font.PLAIN, 12), new PiePlot(), true);
JFreeChart chart2 = new JFreeChart("Title", new Font("SansSerif", Font.PLAIN, 12), new PiePlot(), false);
assertFalse(chart1.equals(chart2));
assertFalse(chart2.equals(chart1));
}
Aggregations