Example usage for org.jfree.chart.plot PiePlot3D setURLGenerator

List of usage examples for org.jfree.chart.plot PiePlot3D setURLGenerator

Introduction

In this page you can find the example usage for org.jfree.chart.plot PiePlot3D setURLGenerator.

Prototype

public void setURLGenerator(PieURLGenerator generator) 

Source Link

Document

Sets the URL generator and sends a PlotChangeEvent to all registered listeners.

Usage

From source file:org.hxzon.demo.jfreechart.PieDatasetDemo2.java

private static JFreeChart createPieChart3D(PieDataset dataset) {

    PiePlot3D plot = new PiePlot3D(dataset);
    plot.setInsets(new RectangleInsets(0.0, 5.0, 5.0, 5.0));
    if (tooltips) {
        plot.setToolTipGenerator(new StandardPieToolTipGenerator());
    }/*from   www.ja  v  a  2  s.  c  o m*/
    if (urls) {
        plot.setURLGenerator(new StandardPieURLGenerator());
    }
    JFreeChart chart = new JFreeChart("Pie Chart 3D Demo 1", JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    plot.setSectionOutlinesVisible(false);
    plot.setNoDataMessage("No data available");

    return chart;

}

From source file:net.sf.jsfcomp.chartcreator.utils.ChartUtils.java

public static JFreeChart createChartWithPieDataSet(ChartData chartData) {
    PieDataset dataset = (PieDataset) chartData.getDatasource();
    String type = chartData.getType();
    boolean legend = chartData.isLegend();
    JFreeChart chart = null;//w  w  w. j  a  v  a  2s  .  c om

    if (type.equalsIgnoreCase("pie")) {
        if (chartData.isChart3d()) {
            chart = ChartFactory.createPieChart3D("", dataset, legend, true, false);
            PiePlot3D plot = (PiePlot3D) chart.getPlot();
            plot.setDepthFactor((float) chartData.getDepth() / 100);
        } else {
            chart = ChartFactory.createPieChart("", dataset, legend, true, false);
        }
    } else if (type.equalsIgnoreCase("ring")) {
        chart = ChartFactory.createRingChart("", dataset, legend, true, false);
    }

    PiePlot plot = (PiePlot) chart.getPlot();
    plot.setStartAngle((float) chartData.getStartAngle());
    if (chartData.getGenerateMap() != null)
        plot.setURLGenerator(new StandardPieURLGenerator(""));

    setPieSectionColors(chart, chartData);

    return chart;
}

From source file:com.ewcms.plugin.report.generate.service.chart.ChartGenerationService.java

/**
 * 3D//w  ww .jav a 2s .co m
 *
 * @param title 
 * @param titleFont 
 * @param data ??
 * @param order
 * @param legend 
 * @param tooltips ????
 * @param urls ??URL
 * @param urlGenerator
 *
 * @return 
 */
public static JFreeChart create3DPieChart(String title, java.awt.Font titleFont, CategoryDataset data,
        TableOrder order, boolean legend, boolean tooltips, boolean urls, PieURLGenerator urlGenerator) {

    MultiplePiePlot plot = new MultiplePiePlot(data);
    plot.setDataExtractOrder(order);

    // plot.setOutlineStroke(null);

    JFreeChart pieChart = new JFreeChart(new PiePlot3D(null));
    pieChart.setBackgroundPaint(null);
    plot.setPieChart(pieChart);

    PiePlot3D pp = (PiePlot3D) plot.getPieChart().getPlot();
    pp.setBackgroundPaint(null);
    // pp.setInsets(new Insets(0, 5, 5, 5));

    pp.setOutlineStroke(null);

    PieToolTipGenerator tooltipGenerator = null;
    if (tooltips) {
        tooltipGenerator = new StandardPieToolTipGenerator();
    }

    if (!urls) {
        urlGenerator = null;
    }

    pp.setToolTipGenerator(tooltipGenerator);
    pp.setLabelGenerator(null);
    pp.setURLGenerator(urlGenerator);
    JFreeChart chart = new JFreeChart(title, titleFont, plot, legend);

    return chart;
}

From source file:com.tonbeller.jpivot.chart.ChartFactory.java

/**
 * Creates a sample dataset for the demo.
 * /*from   w w  w  .  j a v a2 s. c  o m*/
 * @return A sample dataset.
 */
public static JFreeChart create3DPieChart(String title, java.awt.Font titleFont, CategoryDataset data,
        TableOrder order, boolean legend, boolean tooltips, boolean urls, PieURLGenerator urlGenerator) {

    MultiplePiePlot plot = new MultiplePiePlot(data);
    plot.setDataExtractOrder(order);

    //plot.setOutlineStroke(null);

    JFreeChart pieChart = new JFreeChart(new PiePlot3D(null));
    pieChart.setBackgroundPaint(null);
    plot.setPieChart(pieChart);

    PiePlot3D pp = (PiePlot3D) plot.getPieChart().getPlot();
    pp.setBackgroundPaint(null);
    //pp.setInsets(new Insets(0, 5, 5, 5));

    // no outline around each piechart
    pp.setOutlineStroke(null);

    PieToolTipGenerator tooltipGenerator = null;
    if (tooltips) {
        tooltipGenerator = new StandardPieToolTipGenerator();
    }

    if (!urls) {
        urlGenerator = null;
    }

    pp.setToolTipGenerator(tooltipGenerator);
    pp.setLabelGenerator(null);
    pp.setURLGenerator(urlGenerator);
    JFreeChart chart = new JFreeChart(title, titleFont, plot, legend);

    return chart;

}

From source file:edu.dlnu.liuwenpeng.ChartFactory.ChartFactory.java

/**    
* Creates a 3D pie chart using the specified dataset.  The chart object     
* returned by this method uses a {@link PiePlot3D} instance as the    
* plot.    //from w  ww. j a va  2  s. c om
*    
* @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 createPieChart3D(String title, PieDataset dataset, boolean legend, boolean tooltips,
        boolean urls) {

    PiePlot3D plot = new PiePlot3D(dataset);
    plot.setInsets(new RectangleInsets(0.0, 5.0, 5.0, 5.0));
    if (tooltips) {
        plot.setToolTipGenerator(new StandardPieToolTipGenerator());
    }
    if (urls) {
        plot.setURLGenerator(new StandardPieURLGenerator());
    }
    return new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);

}

From source file:KIDLYFactory.java

/**
 * Creates a 3D pie chart using the specified dataset.  The chart object
 * returned by this method uses a {@link PiePlot3D} instance as the
 * plot./*from ww  w  .  j av a 2  s.  co  m*/
 *
 * @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 createPieChart3D(String title, PieDataset dataset, boolean legend, boolean tooltips,
        boolean urls) {

    PiePlot3D plot = new PiePlot3D(dataset);
    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;

}