Search in sources :

Example 1 with StandardPieURLGenerator

use of org.jfree.chart.urls.StandardPieURLGenerator in project pentaho-platform by pentaho.

the class JFreeChartEngine method createPieDatasetChart.

private static JFreeChart createPieDatasetChart(final PieDatasetChartDefinition chartDefinition) {
    // TODO Make the following accessible from the chartDefinition
    boolean tooltips = true;
    boolean urls = true;
    // -----------------------------------------------------------
    String title = chartDefinition.getTitle();
    boolean legend = chartDefinition.isLegendIncluded();
    PiePlot plot = null;
    plot = chartDefinition.isThreeD() ? new PiePlot3D(chartDefinition) : new PiePlot(chartDefinition);
    JFreeChartEngine.updatePlot(plot, chartDefinition);
    JFreeChart pieChart = new JFreeChart(title, chartDefinition.getTitleFont(), plot, legend);
    // $NON-NLS-1$ //$NON-NLS-2$
    TextTitle seriesTitle = new TextTitle("Series Title", new Font("SansSerif", Font.BOLD, 12));
    seriesTitle.setPosition(RectangleEdge.BOTTOM);
    pieChart.setTitle(title);
    pieChart.setBackgroundPaint(chartDefinition.getChartBackgroundPaint());
    if (tooltips) {
        PieToolTipGenerator tooltipGenerator = new StandardPieToolTipGenerator();
        plot.setToolTipGenerator(tooltipGenerator);
    }
    if (urls) {
        PieURLGenerator urlGenerator = new StandardPieURLGenerator();
        plot.setURLGenerator(urlGenerator);
    }
    return pieChart;
}
Also used : TextTitle(org.jfree.chart.title.TextTitle) StandardPieURLGenerator(org.jfree.chart.urls.StandardPieURLGenerator) PieURLGenerator(org.jfree.chart.urls.PieURLGenerator) StandardPieURLGenerator(org.jfree.chart.urls.StandardPieURLGenerator) PiePlot3D(org.jfree.chart.plot.PiePlot3D) PieToolTipGenerator(org.jfree.chart.labels.PieToolTipGenerator) StandardPieToolTipGenerator(org.jfree.chart.labels.StandardPieToolTipGenerator) StandardPieToolTipGenerator(org.jfree.chart.labels.StandardPieToolTipGenerator) PiePlot(org.jfree.chart.plot.PiePlot) MultiplePiePlot(org.jfree.chart.plot.MultiplePiePlot) JFreeChart(org.jfree.chart.JFreeChart) Font(java.awt.Font)

Example 2 with StandardPieURLGenerator

use of org.jfree.chart.urls.StandardPieURLGenerator in project SIMVA-SoS by SESoS.

the class ChartFactory method createMultiplePieChart3D.

/**
 * Creates a chart that displays multiple pie plots.  The chart object
 * returned by this method uses a {@link MultiplePiePlot} instance as the
 * plot.
 *
 * @param title  the chart title (<code>null</code> permitted).
 * @param dataset  the dataset (<code>null</code> permitted).
 * @param order  the order that the data is extracted (by row or by column)
 *               (<code>null</code> not permitted).
 * @param legend  include a legend?
 * @param tooltips  generate tooltips?
 * @param urls  generate URLs?
 *
 * @return A chart.
 */
public static JFreeChart createMultiplePieChart3D(String title, CategoryDataset dataset, TableOrder order, boolean legend, boolean tooltips, boolean urls) {
    ParamChecks.nullNotPermitted(order, "order");
    MultiplePiePlot plot = new MultiplePiePlot(dataset);
    plot.setDataExtractOrder(order);
    plot.setBackgroundPaint(null);
    plot.setOutlineStroke(null);
    JFreeChart pieChart = new JFreeChart(new PiePlot3D(null));
    TextTitle seriesTitle = new TextTitle("Series Title", new Font("SansSerif", Font.BOLD, 12));
    seriesTitle.setPosition(RectangleEdge.BOTTOM);
    pieChart.setTitle(seriesTitle);
    pieChart.removeLegend();
    pieChart.setBackgroundPaint(null);
    plot.setPieChart(pieChart);
    if (tooltips) {
        PieToolTipGenerator tooltipGenerator = new StandardPieToolTipGenerator();
        PiePlot pp = (PiePlot) plot.getPieChart().getPlot();
        pp.setToolTipGenerator(tooltipGenerator);
    }
    if (urls) {
        PieURLGenerator urlGenerator = new StandardPieURLGenerator();
        PiePlot pp = (PiePlot) plot.getPieChart().getPlot();
        pp.setURLGenerator(urlGenerator);
    }
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    currentTheme.apply(chart);
    return chart;
}
Also used : TextTitle(org.jfree.chart.title.TextTitle) StandardPieURLGenerator(org.jfree.chart.urls.StandardPieURLGenerator) PieURLGenerator(org.jfree.chart.urls.PieURLGenerator) StandardPieURLGenerator(org.jfree.chart.urls.StandardPieURLGenerator) PiePlot3D(org.jfree.chart.plot.PiePlot3D) PieToolTipGenerator(org.jfree.chart.labels.PieToolTipGenerator) StandardPieToolTipGenerator(org.jfree.chart.labels.StandardPieToolTipGenerator) StandardPieToolTipGenerator(org.jfree.chart.labels.StandardPieToolTipGenerator) MultiplePiePlot(org.jfree.chart.plot.MultiplePiePlot) PiePlot(org.jfree.chart.plot.PiePlot) MultiplePiePlot(org.jfree.chart.plot.MultiplePiePlot) Font(java.awt.Font)

Example 3 with StandardPieURLGenerator

use of org.jfree.chart.urls.StandardPieURLGenerator 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;
}
Also used : StandardPieURLGenerator(org.jfree.chart.urls.StandardPieURLGenerator) StandardPieToolTipGenerator(org.jfree.chart.labels.StandardPieToolTipGenerator) PiePlot(org.jfree.chart.plot.PiePlot) MultiplePiePlot(org.jfree.chart.plot.MultiplePiePlot) RectangleInsets(org.jfree.ui.RectangleInsets) StandardPieSectionLabelGenerator(org.jfree.chart.labels.StandardPieSectionLabelGenerator)

Example 4 with StandardPieURLGenerator

use of org.jfree.chart.urls.StandardPieURLGenerator 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;
}
Also used : StandardPieURLGenerator(org.jfree.chart.urls.StandardPieURLGenerator) RingPlot(org.jfree.chart.plot.RingPlot) StandardPieToolTipGenerator(org.jfree.chart.labels.StandardPieToolTipGenerator) RectangleInsets(org.jfree.ui.RectangleInsets) StandardPieSectionLabelGenerator(org.jfree.chart.labels.StandardPieSectionLabelGenerator)

Example 5 with StandardPieURLGenerator

use of org.jfree.chart.urls.StandardPieURLGenerator in project SIMVA-SoS by SESoS.

the class ChartFactory method createMultiplePieChart.

/**
 * Creates a chart that displays multiple pie plots.  The chart object
 * returned by this method uses a {@link MultiplePiePlot} instance as the
 * plot.
 *
 * @param title  the chart title (<code>null</code> permitted).
 * @param dataset  the dataset (<code>null</code> permitted).
 * @param order  the order that the data is extracted (by row or by column)
 *               (<code>null</code> not permitted).
 * @param legend  include a legend?
 * @param tooltips  generate tooltips?
 * @param urls  generate URLs?
 *
 * @return A chart.
 */
public static JFreeChart createMultiplePieChart(String title, CategoryDataset dataset, TableOrder order, boolean legend, boolean tooltips, boolean urls) {
    ParamChecks.nullNotPermitted(order, "order");
    MultiplePiePlot plot = new MultiplePiePlot(dataset);
    plot.setDataExtractOrder(order);
    plot.setBackgroundPaint(null);
    plot.setOutlineStroke(null);
    if (tooltips) {
        PieToolTipGenerator tooltipGenerator = new StandardPieToolTipGenerator();
        PiePlot pp = (PiePlot) plot.getPieChart().getPlot();
        pp.setToolTipGenerator(tooltipGenerator);
    }
    if (urls) {
        PieURLGenerator urlGenerator = new StandardPieURLGenerator();
        PiePlot pp = (PiePlot) plot.getPieChart().getPlot();
        pp.setURLGenerator(urlGenerator);
    }
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    currentTheme.apply(chart);
    return chart;
}
Also used : StandardPieURLGenerator(org.jfree.chart.urls.StandardPieURLGenerator) PieURLGenerator(org.jfree.chart.urls.PieURLGenerator) StandardPieURLGenerator(org.jfree.chart.urls.StandardPieURLGenerator) PieToolTipGenerator(org.jfree.chart.labels.PieToolTipGenerator) StandardPieToolTipGenerator(org.jfree.chart.labels.StandardPieToolTipGenerator) StandardPieToolTipGenerator(org.jfree.chart.labels.StandardPieToolTipGenerator) MultiplePiePlot(org.jfree.chart.plot.MultiplePiePlot) PiePlot(org.jfree.chart.plot.PiePlot) MultiplePiePlot(org.jfree.chart.plot.MultiplePiePlot)

Aggregations

StandardPieToolTipGenerator (org.jfree.chart.labels.StandardPieToolTipGenerator)8 StandardPieURLGenerator (org.jfree.chart.urls.StandardPieURLGenerator)8 MultiplePiePlot (org.jfree.chart.plot.MultiplePiePlot)5 PiePlot (org.jfree.chart.plot.PiePlot)5 Font (java.awt.Font)4 StandardPieSectionLabelGenerator (org.jfree.chart.labels.StandardPieSectionLabelGenerator)4 RectangleInsets (org.jfree.ui.RectangleInsets)4 PieToolTipGenerator (org.jfree.chart.labels.PieToolTipGenerator)3 PiePlot3D (org.jfree.chart.plot.PiePlot3D)3 TextTitle (org.jfree.chart.title.TextTitle)3 PieURLGenerator (org.jfree.chart.urls.PieURLGenerator)3 BasicStroke (java.awt.BasicStroke)1 Color (java.awt.Color)1 GradientPaint (java.awt.GradientPaint)1 Stroke (java.awt.Stroke)1 Rectangle2D (java.awt.geom.Rectangle2D)1 Iterator (java.util.Iterator)1 List (java.util.List)1 JFreeChart (org.jfree.chart.JFreeChart)1 RingPlot (org.jfree.chart.plot.RingPlot)1