use of org.jfree.chart.labels.StandardPieSectionLabelGenerator in project tdq-studio-se by Talend.
the class ChartDecorator method decoratePiePlot.
/**
* DOC qiongli Comment method "decoratePiePlot".
*
* @param chart
*/
private static void decoratePiePlot(JFreeChart chart) {
// $NON-NLS-1$
Font font = new Font("sans-serif", Font.BOLD, BASE_TITLE_LABEL_SIZE);
TextTitle textTitle = chart.getTitle();
// MOD msjian TDQ-5213 2012-5-7: fixed NPE
if (textTitle != null) {
textTitle.setFont(font);
}
setLegendFont(chart);
// TDQ-5213~
PiePlot plot = (PiePlot) chart.getPlot();
// $NON-NLS-1$
font = new Font("Monospaced", Font.PLAIN, 10);
plot.setLabelFont(font);
// $NON-NLS-1$
plot.setNoDataMessage("No data available");
StandardPieSectionLabelGenerator standardPieSectionLabelGenerator = new // $NON-NLS-1$
StandardPieSectionLabelGenerator(// $NON-NLS-1$
("{0}:{2}"), NumberFormat.getNumberInstance(), new DecimalFormat(PERCENT_FORMAT));
plot.setLabelGenerator(standardPieSectionLabelGenerator);
plot.setLabelLinkPaint(Color.GRAY);
plot.setLabelOutlinePaint(Color.WHITE);
plot.setLabelGap(0.02D);
plot.setOutlineVisible(false);
plot.setMaximumLabelWidth(0.2D);
plot.setCircular(false);
// remove the shadow of the pie chart
plot.setShadowXOffset(0);
plot.setShadowYOffset(0);
}
use of org.jfree.chart.labels.StandardPieSectionLabelGenerator 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.labels.StandardPieSectionLabelGenerator 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);
}
Aggregations