Java Code Examples for org.jfree.chart.plot.PiePlot#setInsets()
The following examples show how to use
org.jfree.chart.plot.PiePlot#setInsets() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ChartFactory.java From ECG-Viewer with GNU General Public License v2.0 | 6 votes |
/** * 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; }
Example 2
Source File: ChartFactory.java From buffer_bci with GNU General Public License v3.0 | 6 votes |
/** * 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; }
Example 3
Source File: ChartFactory.java From buffer_bci with GNU General Public License v3.0 | 6 votes |
/** * 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; }
Example 4
Source File: ChartFactory.java From opensim-gui with Apache License 2.0 | 6 votes |
/** * 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( StandardPieToolTipGenerator.DEFAULT_SECTION_LABEL_FORMAT)); } if (urls) { plot.setURLGenerator(new StandardPieURLGenerator()); } return new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); }
Example 5
Source File: ChartFactory.java From astor with GNU General Public License v2.0 | 6 votes |
/** * 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()); } return new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); }
Example 6
Source File: ChartFactory.java From SIMVA-SoS with Apache License 2.0 | 6 votes |
/** * 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; }
Example 7
Source File: ChartFactory.java From ccu-historian with GNU General Public License v3.0 | 6 votes |
/** * 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; }
Example 8
Source File: ChartFactory.java From openstock with GNU General Public License v3.0 | 6 votes |
/** * 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; }
Example 9
Source File: GraphStatsView.java From eclipse-cs with GNU Lesser General Public License v2.1 | 5 votes |
/** * Crée le graphe JFreeChart. * * @param piedataset * : la source de données à afficher * @return le diagramme */ private JFreeChart createChart(GraphPieDataset piedataset) { JFreeChart jfreechart = ChartFactory.createPieChart3D(null, piedataset, false, true, false); jfreechart.setAntiAlias(true); jfreechart.setTextAntiAlias(true); PiePlot pieplot3d = (PiePlot) jfreechart.getPlot(); pieplot3d.setInsets(new RectangleInsets(0, 0, 0, 0)); final double angle = 290D; pieplot3d.setStartAngle(angle); pieplot3d.setDirection(Rotation.CLOCKWISE); final float foreground = 0.5F; pieplot3d.setForegroundAlpha(foreground); pieplot3d.setNoDataMessage(Messages.GraphStatsView_noDataToDisplay); pieplot3d.setCircular(true); pieplot3d.setOutlinePaint(null); pieplot3d.setLabelFont(new Font("SansSerif", Font.PLAIN, 10)); pieplot3d.setLabelGap(0.02); pieplot3d.setLabelOutlinePaint(null); pieplot3d.setLabelShadowPaint(null); pieplot3d.setLabelBackgroundPaint(Color.WHITE); pieplot3d.setBackgroundPaint(Color.WHITE); // avoid showing the percentage as an absolute number in the tooltip pieplot3d.setToolTipGenerator(new StandardPieToolTipGenerator("{0}: {2}")); pieplot3d.setInteriorGap(0.02); pieplot3d.setMaximumLabelWidth(0.20); return jfreechart; }
Example 10
Source File: ChartFactory.java From SIMVA-SoS with Apache License 2.0 | 4 votes |
/** * 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; }
Example 11
Source File: ChartServiceImpl.java From sakai with Educational Community License v2.0 | 4 votes |
private byte[] generatePieChart( String siteId, PieDataset dataset, int width, int height, boolean render3d, float transparency, boolean smallFontInDomainAxis) { JFreeChart chart = null; if(render3d) chart = ChartFactory.createPieChart3D(null, dataset, false, false, false); else chart = ChartFactory.createPieChart(null, dataset, false, false, false); PiePlot plot = (PiePlot) chart.getPlot(); // set start angle (135 or 150 deg so minor data has more space on the left) plot.setStartAngle(150D); // set transparency plot.setForegroundAlpha(transparency); // set background chart.setBackgroundPaint(parseColor(M_sm.getChartBackgroundColor())); plot.setBackgroundPaint(parseColor(M_sm.getChartBackgroundColor())); // fix border offset chart.setPadding(new RectangleInsets(5,5,5,5)); plot.setInsets(new RectangleInsets(1,1,1,1)); // set chart border plot.setOutlinePaint(null); chart.setBorderVisible(true); chart.setBorderPaint(parseColor("#cccccc")); // set antialias chart.setAntiAlias(true); BufferedImage img = chart.createBufferedImage(width, height); final ByteArrayOutputStream out = new ByteArrayOutputStream(); try{ ImageIO.write(img, "png", out); }catch(IOException e){ log.warn("Error occurred while generating SiteStats chart image data", e); } return out.toByteArray(); }
Example 12
Source File: ChartFactory.java From ECG-Viewer with GNU General Public License v2.0 | 4 votes |
/** * 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; }
Example 13
Source File: ChartFactory.java From openstock with GNU General Public License v3.0 | 4 votes |
/** * 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; }
Example 14
Source File: ChartFactory.java From ccu-historian with GNU General Public License v3.0 | 4 votes |
/** * 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; }
Example 15
Source File: ChartServiceImpl.java From sakai with Educational Community License v2.0 | 4 votes |
private byte[] generatePieChart( String siteId, PieDataset dataset, int width, int height, boolean render3d, float transparency, boolean smallFontInDomainAxis) { JFreeChart chart = null; if(render3d) chart = ChartFactory.createPieChart3D(null, dataset, false, false, false); else chart = ChartFactory.createPieChart(null, dataset, false, false, false); PiePlot plot = (PiePlot) chart.getPlot(); // set start angle (135 or 150 deg so minor data has more space on the left) plot.setStartAngle(150D); // set transparency plot.setForegroundAlpha(transparency); // set background chart.setBackgroundPaint(parseColor(M_sm.getChartBackgroundColor())); plot.setBackgroundPaint(parseColor(M_sm.getChartBackgroundColor())); // fix border offset chart.setPadding(new RectangleInsets(5,5,5,5)); plot.setInsets(new RectangleInsets(1,1,1,1)); // set chart border plot.setOutlinePaint(null); chart.setBorderVisible(true); chart.setBorderPaint(parseColor("#cccccc")); // set antialias chart.setAntiAlias(true); BufferedImage img = chart.createBufferedImage(width, height); final ByteArrayOutputStream out = new ByteArrayOutputStream(); try{ ImageIO.write(img, "png", out); }catch(IOException e){ log.warn("Error occurred while generating SiteStats chart image data", e); } return out.toByteArray(); }
Example 16
Source File: ChartFactory.java From buffer_bci with GNU General Public License v3.0 | 4 votes |
/** * 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; }
Example 17
Source File: ChartFactory.java From buffer_bci with GNU General Public License v3.0 | 4 votes |
/** * 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; }
Example 18
Source File: ChartFactory.java From astor with GNU General Public License v2.0 | 3 votes |
/** * 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 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, Locale locale) { PiePlot plot = new PiePlot(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, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); currentTheme.apply(chart); return chart; }
Example 19
Source File: ChartFactory.java From astor with GNU General Public License v2.0 | 3 votes |
/** * 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)); } return new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); }