Example usage for org.jfree.chart.plot RingPlot setInsets

List of usage examples for org.jfree.chart.plot RingPlot setInsets

Introduction

In this page you can find the example usage for org.jfree.chart.plot RingPlot setInsets.

Prototype

public void setInsets(RectangleInsets insets) 

Source Link

Document

Sets the insets for the plot and sends a PlotChangeEvent to all registered listeners.

Usage

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

private static JFreeChart createRingChart(PieDataset dataset) {

    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());
    }/*from   w  ww  .  ja v  a2  s .  c  o m*/
    if (urls) {
        plot.setURLGenerator(new StandardPieURLGenerator());
    }
    JFreeChart chart = new JFreeChart("Ring Chart Demo 1", JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    plot.setSectionOutlinesVisible(false);
    plot.setNoDataMessage("No data available");

    return chart;

}

From source file:Visuals.RingChart.java

public ChartPanel drawRingChart() {
    DefaultPieDataset dataset = new DefaultPieDataset();
    if (riskCount == 0) {
        dataset.setValue(noVulnerabilities, new Integer(1));
    } else {//from w  w w .  jav  a  2 s  .c o m
        if (critical > 0)
            dataset.setValue(criticalValue, new Integer(critical));
        if (low > 0)
            dataset.setValue(lowValue, new Integer(low));
        if (medium > 0)
            dataset.setValue(mediumValue, new Integer(medium));
        if (high > 0)
            dataset.setValue(highValue, new Integer(high));

    }

    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));
    //        }
    if (riskCount == 0) {
        plot.setSectionPaint(noVulnerabilities, new Color(47, 196, 6));
    } else {
        plot.setSectionPaint(criticalValue, new Color(230, 27, 27));
        plot.setSectionPaint(highValue, new Color(230, 90, 27));
        plot.setSectionPaint(mediumValue, new Color(85, 144, 176));
        if (lowValue.equals("Updated (" + low + ")")) {
            plot.setSectionPaint(lowValue, new Color(47, 196, 6));
        } else
            plot.setSectionPaint(lowValue, new Color(230, 219, 27));
    }
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, true);
    CategoryItemRenderer renderer = new CustomRenderer();
    renderer.setItemLabelsVisible(false);
    plot.setLabelLinksVisible(false);
    plot.setLabelGenerator(null);
    plot.setBackgroundPaint(new Color(210, 234, 243));
    ChartPanel chartPanel = new ChartPanel(chart);
    return chartPanel;

    //        if(isMain)
    //        {
    //            piechart.removeLegend();
    //        }
}

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

/**    
* Creates a ring chart with default settings.    
* <P>    /*from   w ww. j av a  2  s. c o m*/
* 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());
    }
    return new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);

}

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

/**    
* Creates a ring chart with default settings.    
* <P>    // w ww.ja v a  2s.c  o m
* 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));
    }
    return new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);

}

From source file:KIDLYFactory.java

/**
 * Creates a ring chart with default settings.
 * <P>//from w  ww . j a v a  2s  . c o  m
 * 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;

}

From source file:KIDLYFactory.java

/**
 * Creates a ring chart with default settings.
 * <P>/*from w ww . j a va  2 s.c o m*/
 * 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;
}

From source file:org.jfree.chart.ChartFactory.java

/**
 * Creates a ring chart with default settings.
 * <P>/*from  w  ww  .  j  a va2 s.co m*/
 * The chart object returned by this method uses a {@link RingPlot}
 * instance as the plot.
 *
 * @param title  the chart title ({@code null} permitted).
 * @param dataset  the dataset for the chart ({@code null} permitted).
 * @param locale  the locale ({@code null} not permitted).
 *
 * @return A ring chart.
 *
 * @since 1.0.7
 */
public static JFreeChart createRingChart(String title, PieDataset dataset, Locale locale) {

    RingPlot plot = new RingPlot(dataset);
    plot.setLabelGenerator(new StandardPieSectionLabelGenerator(locale));
    plot.setInsets(new RectangleInsets(0.0, 5.0, 5.0, 5.0));
    plot.setToolTipGenerator(new StandardPieToolTipGenerator(locale));
    JFreeChart chart = new JFreeChart(title, plot);
    currentTheme.apply(chart);
    return chart;
}

From source file:org.jfree.chart.ChartFactory.java

/**
 * Creates a ring chart with default settings.
 * <P>/*w  w  w  .  ja  va  2s  . c  o  m*/
 * The chart object returned by this method uses a {@link RingPlot}
 * instance as the plot.
 *
 * @param title  the chart title ({@code null} permitted).
 * @param dataset  the dataset for the chart ({@code null} permitted).
 *
 * @return A ring chart.
 */
public static JFreeChart createRingChart(String title, PieDataset dataset) {

    RingPlot plot = new RingPlot(dataset);
    plot.setLabelGenerator(new StandardPieSectionLabelGenerator());
    plot.setInsets(new RectangleInsets(0.0, 5.0, 5.0, 5.0));
    plot.setToolTipGenerator(new StandardPieToolTipGenerator());
    JFreeChart chart = new JFreeChart(title, plot);
    currentTheme.apply(chart);
    return chart;

}