use of org.jfree.chart.labels.StandardPieSectionLabelGenerator in project SIMVA-SoS by SESoS.
the class ChartFactory method createPieChart.
/**
* Creates a pie chart with default settings.
* <P>
* The chart object returned by this method uses a {@link PiePlot} instance
* as the plot.
*
* @param title the chart title (<code>null</code> permitted).
* @param dataset the dataset for the chart (<code>null</code> permitted).
* @param legend a flag specifying whether or not a legend is required.
* @param tooltips configure chart to generate tool tips?
* @param urls configure chart to generate URLs?
*
* @return A pie chart.
*/
public static JFreeChart createPieChart(String title, PieDataset dataset, boolean legend, boolean tooltips, boolean urls) {
PiePlot plot = new PiePlot(dataset);
plot.setLabelGenerator(new StandardPieSectionLabelGenerator());
plot.setInsets(new RectangleInsets(0.0, 5.0, 5.0, 5.0));
if (tooltips) {
plot.setToolTipGenerator(new StandardPieToolTipGenerator());
}
if (urls) {
plot.setURLGenerator(new StandardPieURLGenerator());
}
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
currentTheme.apply(chart);
return chart;
}
use of org.jfree.chart.labels.StandardPieSectionLabelGenerator in project SIMVA-SoS by SESoS.
the class ChartFactory method createRingChart.
/**
* Creates a ring chart with default settings.
* <P>
* The chart object returned by this method uses a {@link RingPlot}
* instance as the plot.
*
* @param title the chart title (<code>null</code> permitted).
* @param dataset the dataset for the chart (<code>null</code> permitted).
* @param legend a flag specifying whether or not a legend is required.
* @param tooltips configure chart to generate tool tips?
* @param urls configure chart to generate URLs?
*
* @return A ring chart.
*/
public static JFreeChart createRingChart(String title, PieDataset dataset, boolean legend, boolean tooltips, boolean urls) {
RingPlot plot = new RingPlot(dataset);
plot.setLabelGenerator(new StandardPieSectionLabelGenerator());
plot.setInsets(new RectangleInsets(0.0, 5.0, 5.0, 5.0));
if (tooltips) {
plot.setToolTipGenerator(new StandardPieToolTipGenerator());
}
if (urls) {
plot.setURLGenerator(new StandardPieURLGenerator());
}
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
currentTheme.apply(chart);
return chart;
}
use of org.jfree.chart.labels.StandardPieSectionLabelGenerator in project SIMVA-SoS by SESoS.
the class ChartFactory method createPieChart.
/**
* Creates a pie chart with default settings.
* <P>
* The chart object returned by this method uses a {@link PiePlot} instance
* as the plot.
*
* @param title the chart title (<code>null</code> permitted).
* @param dataset the dataset for the chart (<code>null</code> permitted).
* @param legend a flag specifying whether or not a legend is required.
* @param tooltips configure chart to generate tool tips?
* @param locale the locale (<code>null</code> not permitted).
*
* @return A pie chart.
*
* @since 1.0.7
*/
public static JFreeChart createPieChart(String title, PieDataset dataset, boolean legend, boolean tooltips, Locale locale) {
PiePlot plot = new PiePlot(dataset);
plot.setLabelGenerator(new StandardPieSectionLabelGenerator(locale));
plot.setInsets(new RectangleInsets(0.0, 5.0, 5.0, 5.0));
if (tooltips) {
plot.setToolTipGenerator(new StandardPieToolTipGenerator(locale));
}
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
currentTheme.apply(chart);
return chart;
}
use of org.jfree.chart.labels.StandardPieSectionLabelGenerator in project SIMVA-SoS by SESoS.
the class ChartFactory method createRingChart.
/**
* Creates a ring chart with default settings.
* <P>
* The chart object returned by this method uses a {@link RingPlot}
* instance as the plot.
*
* @param title the chart title (<code>null</code> permitted).
* @param dataset the dataset for the chart (<code>null</code> permitted).
* @param legend a flag specifying whether or not a legend is required.
* @param tooltips configure chart to generate tool tips?
* @param locale the locale (<code>null</code> not permitted).
*
* @return A ring chart.
*
* @since 1.0.7
*/
public static JFreeChart createRingChart(String title, PieDataset dataset, boolean legend, boolean tooltips, Locale locale) {
RingPlot plot = new RingPlot(dataset);
plot.setLabelGenerator(new StandardPieSectionLabelGenerator(locale));
plot.setInsets(new RectangleInsets(0.0, 5.0, 5.0, 5.0));
if (tooltips) {
plot.setToolTipGenerator(new StandardPieToolTipGenerator(locale));
}
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
currentTheme.apply(chart);
return chart;
}
use of org.jfree.chart.labels.StandardPieSectionLabelGenerator in project MtgDesktopCompanion by nicho92.
the class ManaRepartitionPanel method refresh.
private void refresh() {
this.removeAll();
JFreeChart chart = ChartFactory.createPieChart3D(// chart title
"Color repartition", // data
getManaRepartitionDataSet(), // include legend
false, true, true);
pane = new ChartPanel(chart);
PiePlot plot = (PiePlot) chart.getPlot();
plot.setSectionPaint("Black", Color.BLACK);
plot.setSectionPaint("White", Color.WHITE);
plot.setSectionPaint("Blue", Color.BLUE);
plot.setSectionPaint("Green", Color.GREEN);
plot.setSectionPaint("Red", Color.RED);
plot.setSectionPaint("Multi", Color.YELLOW);
plot.setSectionPaint("Uncolor", Color.GRAY);
plot.setSectionPaint("black", Color.BLACK);
plot.setSectionPaint("white", Color.WHITE);
plot.setSectionPaint("blue", Color.BLUE);
plot.setSectionPaint("green", Color.GREEN);
plot.setSectionPaint("red", Color.RED);
plot.setSectionPaint("multi", Color.YELLOW);
plot.setSectionPaint("uncolor", Color.GRAY);
plot.setSimpleLabels(true);
PieSectionLabelGenerator generator = new StandardPieSectionLabelGenerator("{1}", new DecimalFormat("0"), new DecimalFormat("0.00%"));
plot.setLabelGenerator(generator);
this.add(pane, BorderLayout.CENTER);
this.revalidate();
this.repaint();
}
Aggregations