List of usage examples for org.jfree.chart.plot MultiplePiePlot setPieChart
public void setPieChart(JFreeChart pieChart)
From source file:com.tonbeller.jpivot.chart.ChartFactory.java
/** * Creates a sample dataset for the demo. * //from w w w. j a va2 s . c om * @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:com.ewcms.plugin.report.generate.service.chart.ChartGenerationService.java
/** * 3D// www . j a v a2s .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:org.hxzon.demo.jfreechart.CategoryDatasetDemo2.java
private static JFreeChart createMultiplePieChart3D_2(CategoryDataset dataset) { MultiplePiePlot plot = new MultiplePiePlot(dataset); plot.setDataExtractOrder(TableOrder.BY_ROW); plot.setBackgroundPaint(null);// w w w .j a v a 2 s. c o m 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("MultiplePie Chart 3D Demo 2", JFreeChart.DEFAULT_TITLE_FONT, plot, legend); chart.setBackgroundPaint(Color.white); return chart; }
From source file:org.hxzon.demo.jfreechart.CategoryDatasetDemo2.java
private static JFreeChart createMultiplePieChart3D(CategoryDataset dataset) { MultiplePiePlot plot = new MultiplePiePlot(dataset); plot.setDataExtractOrder(TableOrder.BY_COLUMN); plot.setBackgroundPaint(null);//from w w w. java 2 s . c om 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("MultiplePie Chart 3D Demo 1", JFreeChart.DEFAULT_TITLE_FONT, plot, legend); chart.setBackgroundPaint(Color.white); PiePlot piePlot = (PiePlot) pieChart.getPlot(); GradientPaint gp0 = new GradientPaint(0.0f, 0.0f, Color.blue, 0.0f, 0.0f, new Color(0, 0, 64)); GradientPaint gp1 = new GradientPaint(0.0f, 0.0f, Color.green, 0.0f, 0.0f, new Color(0, 64, 0)); GradientPaint gp2 = new GradientPaint(0.0f, 0.0f, Color.red, 0.0f, 0.0f, new Color(64, 0, 0)); piePlot.setSectionPaint("First", gp0); piePlot.setSectionPaint("Second", gp1); piePlot.setSectionPaint("Third", gp2); return chart; }
From source file:ca.sqlpower.wabit.swingui.chart.ChartSwingUtil.java
/** * Creates a chart that displays multiple 3D pie plots that have a GradientPaintTransformer. * 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?// w w w . j av a2s . c o m * @param tooltips generate tooltips? * @param urls generate URLs? * * @return A chart. */ private static JFreeChart createPieChart(String title, CategoryDataset dataset, TableOrder order, boolean legend, boolean tooltips, boolean urls) { if (order == null) { throw new IllegalArgumentException("Null 'order' argument."); } MultiplePiePlot plot = new MultiplePiePlot(dataset); plot.setDataExtractOrder(order); plot.setBackgroundPaint(null); plot.setOutlineStroke(null); JFreeChart pieChart = new JFreeChart(new PiePlot3DGradient(null)); TextTitle seriesTitle = new TextTitle("Series Title", new Font("SansSerif", Font.BOLD, 10)); seriesTitle.setPosition(RectangleEdge.BOTTOM); pieChart.setTitle(seriesTitle); pieChart.getTitle().setPadding(0, 0, 0, 0); pieChart.removeLegend(); pieChart.setBackgroundPaint(null); pieChart.setPadding(new RectangleInsets(0, 0, 0, 0)); pieChart.getPlot().setInsets(new RectangleInsets(0, 0, 0, 0)); 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); return chart; }
From source file:org.pentaho.platform.uifoundation.chart.JFreeChartEngine.java
private static JFreeChart createMultiplePieChart(final CategoryDatasetChartDefinition chartDefinition) { // TODO Make the following accessible from the chartDefinition TableOrder order = TableOrder.BY_ROW; // boolean tooltips = true; // boolean urls = true; // ----------------------------------------------------------- String title = chartDefinition.getTitle(); boolean legend = chartDefinition.isLegendIncluded(); if (order == null) { throw new IllegalArgumentException( Messages.getInstance().getString("JFreeChartEngine.ERROR_0001_NULL_ORDER_ARGUMENT")); //$NON-NLS-1$ }//from w ww. j av a 2 s . c om MultiplePiePlot plot = new MultiplePiePlot(chartDefinition); JFreeChartEngine.updatePlot(plot, chartDefinition); plot.setDataExtractOrder(order); JFreeChart pieCharts = new JFreeChart(title, chartDefinition.getTitleFont(), plot, legend); JFreeChart pieChart = plot.getPieChart(); TextTitle seriesTitle = new TextTitle("Series Title", new Font("SansSerif", Font.BOLD, 12)); //$NON-NLS-1$ //$NON-NLS-2$ seriesTitle.setPosition(RectangleEdge.BOTTOM); pieChart.setTitle(seriesTitle); pieChart.setBackgroundPaint(chartDefinition.getChartBackgroundPaint()); 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); // } return pieCharts; }
From source file:edu.dlnu.liuwenpeng.ChartFactory.ChartFactory.java
/** * Creates a chart that displays multiple pie plots. The chart object * returned by this method uses a {@link MultiplePiePlot} instance as the * plot. /* www . j a v a 2s . c o m*/ * * @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) { if (order == null) { throw new IllegalArgumentException("Null 'order' argument."); } 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); return chart; }
From source file:KIDLYFactory.java
/** * Creates a chart that displays multiple pie plots. The chart object * returned by this method uses a {@link MultiplePiePlot} instance as the * plot.//from w ww .ja v a 2s .co m * * @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) { if (order == null) { throw new IllegalArgumentException("Null 'order' argument."); } 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; }
From source file:org.jfree.chart.ChartFactory.java
/** * Creates a chart that displays multiple pie plots. The chart object * returned by this method uses a {@link MultiplePiePlot} instance as the * plot.// w ww .j a va 2 s.c o m * * @param title the chart title ({@code null} permitted). * @param dataset the dataset ({@code null} permitted). * @param order the order that the data is extracted (by row or by column) * ({@code null} not permitted). * * @return A chart. */ public static JFreeChart createMultiplePieChart3D(String title, CategoryDataset dataset, TableOrder order) { ParamChecks.nullNotPermitted(order, "order"); MultiplePiePlot plot = new MultiplePiePlot(dataset); plot.setDataExtractOrder(order); plot.setBackgroundPainter(null); plot.setBorderPainter(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.setBackgroundPainter(null); plot.setPieChart(pieChart); PieToolTipGenerator tooltipGenerator = new StandardPieToolTipGenerator(); PiePlot pp = (PiePlot) plot.getPieChart().getPlot(); pp.setToolTipGenerator(tooltipGenerator); JFreeChart chart = new JFreeChart(title, plot); currentTheme.apply(chart); return chart; }