/** * Creates a 3D pie chart using the specified dataset. The chart object * returned by this method uses a {@link PiePlot3D} 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 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); }
/** * Creates 3D pie chart with OS usage statistics. * * @return Filled 3D pie chart. */ public JFreeChart getChart() { DefaultPieDataset data = new DefaultPieDataset(); data.setValue("Mac", 29); data.setValue("Windows", 51); data.setValue("Linux", 20); JFreeChart chart = ChartFactory.createPieChart3D("", data); PiePlot3D plot = (PiePlot3D) chart.getPlot(); plot.setStartAngle(290); plot.setDirection(Rotation.CLOCKWISE); plot.setForegroundAlpha(0.5f); return chart; }
/** * Creates a 3D pie chart using the specified dataset. * <P> * The chart object returned by this method uses a {@link PiePlot3D} 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 createPieChart3D(String title, PieDataset dataset, boolean legend, boolean tooltips, boolean urls) { PiePlot3D plot = new PiePlot3D(dataset); plot.setInsets(new Insets(0, 5, 5, 5)); if (tooltips) { plot.setToolTipGenerator(new StandardPieItemLabelGenerator()); } if (urls) { plot.setURLGenerator(new StandardPieURLGenerator()); } return new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); }
/** * Creates a 3D pie chart using the specified dataset. The chart object * returned by this method uses a {@link PiePlot3D} 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 createPieChart3D(String title, PieDataset dataset, boolean legend, boolean tooltips, Locale locale) { ParamChecks.nullNotPermitted(locale, "locale"); PiePlot3D plot = new PiePlot3D(dataset); 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; }
/** * Creates a 3D pie chart using the specified dataset. The chart object * returned by this method uses a {@link PiePlot3D} 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 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; }
/** * Creates a 3D pie chart using the specified dataset. The chart object * returned by this method uses a {@link PiePlot3D} instance as the * plot. * * @param title the chart title ({@code null} permitted). * @param dataset the dataset for the chart ({@code null} 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} not permitted). * * @return A pie chart. * * @since 1.0.7 */ public static JFreeChart createPieChart3D(String title, PieDataset dataset, boolean legend, boolean tooltips, Locale locale) { Args.nullNotPermitted(locale, "locale"); PiePlot3D plot = new PiePlot3D(dataset); 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; }
/** * Creates a 3D pie chart using the specified dataset. The chart object * returned by this method uses a {@link PiePlot3D} instance as the * plot. * * @param title the chart title ({@code null} permitted). * @param dataset the dataset for the chart ({@code null} 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; }
public void graficarEstado() { String TAct = txtTotalActivo.getText(); // String TAsp = txtTotalAspirante.getText(); String TMor = txtTotalMoroso.getText(); DefaultPieDataset pieDataset = new DefaultPieDataset(); // pieDataset.setValue("Aspirante", new Integer(TAsp)); pieDataset.setValue("Activo", new Integer(TAct)); pieDataset.setValue("Moroso", new Integer(TMor)); JFreeChart chart = ChartFactory.createPieChart3D("Estado de los Socios", pieDataset, true, true, true); PiePlot3D p = (PiePlot3D) chart.getPlot(); ChartFrame frame = new ChartFrame("Grafico de Torta", chart); frame.setVisible(true); frame.setSize(700, 500); }
/** * Creates a chart */ private JFreeChart createChart(PieDataset dataset, String title) { JFreeChart chart = ChartFactory.createPieChart3D(title, // chart title dataset, // data true, // include legend true, false); PiePlot3D plot = (PiePlot3D) chart.getPlot(); plot.setStartAngle(290); plot.setDirection(Rotation.CLOCKWISE); plot.setForegroundAlpha(0.5f); return chart; }
private JFreeChart createPieChart(ReportChart reportChart, ChartValue[] values, boolean displayInline) { PieDataset dataset = createPieDataset(values); PiePlot3D plot = new PiePlot3D(dataset); plot.setToolTipGenerator(new StandardPieToolTipGenerator()); if (reportChart.getDrillDownReport() != null) { plot.setURLGenerator(new StandardPieURLGenerator( "executeReport.action?displayInline=" + displayInline + "&exportType=0&reportId=" + reportChart.getDrillDownReport().getId(), ReportChart.DRILLDOWN_PARAMETER, "pieIndex")); } JFreeChart chart = new JFreeChart(reportChart.getTitle(), JFreeChart.DEFAULT_TITLE_FONT, plot, reportChart.isShowLegend()); return chart; }
private JFreeChart createChart(PieDataset dataset, String title) { JFreeChart chart = ChartFactory.createPieChart3D(title, // chart title dataset, // data true, // include legend true, true); PiePlot3D plot = (PiePlot3D) chart.getPlot(); plot.setStartAngle(290); PieSectionLabelGenerator gen = new StandardPieSectionLabelGenerator( "{0}: {1} ({2})", new DecimalFormat("0"), new DecimalFormat("0%")); plot.setLabelGenerator(gen); plot.setDirection(Rotation.CLOCKWISE); plot.setForegroundAlpha(0.5f); return chart; }
public String PieChart() { DefaultPieDataset dataset = new DefaultPieDataset(); List<Datas> list = new IncomeDao().getDatas2(park.getParkid()); for (Datas datas : list) { dataset.setValue(datas.getYear() + "年" + datas.getMonth() + "月", datas.getMoney()); } ChartFactory.setChartTheme(getStandardChartTheme()); chart = ChartFactory.createPieChart3D("停车场饼图", dataset, true, true, false); PiePlot3D plot = (PiePlot3D) chart.getPlot(); plot.setBaseSectionOutlinePaint(Color.RED);// 设置图形边框颜色 plot.setBaseSectionOutlineStroke(new BasicStroke(1.0f));// 设置图形边框粗细 plot.setForegroundAlpha(0.5f);// 数据区的前景透明度(0.0~1.0) plot.setCircular(true);// 饼图是否一定是正圆 plot.setStartAngle(360);// 饼图的初始角度 plot.setToolTipGenerator(new StandardPieToolTipGenerator());// 设置鼠标悬停提示 plot.setLabelFont(new Font("微软雅黑", Font.PLAIN, 14)); StandardPieSectionLabelGenerator standarPieIG = new StandardPieSectionLabelGenerator( "{0}:({1},{2})", NumberFormat.getNumberInstance(), NumberFormat.getPercentInstance()); plot.setLabelGenerator(standarPieIG); chart.setTitle(getTitle()); return SUCCESS; }
private void set3d(Plot plot) { if(!show3d) return; plot.setForegroundAlpha(0.6f); if(plot instanceof CategoryPlot) { plot.setForegroundAlpha(0.8f); CategoryPlot cp=(CategoryPlot) plot; CategoryItemRenderer renderer = cp.getRenderer(); if(renderer instanceof BarRenderer3D) { BarRenderer3D br3d=(BarRenderer3D) renderer; cp.setRenderer(new BarRenderer3DWrap(br3d,xoffset,yoffset)); } } else if(plot instanceof PiePlot3D) { PiePlot3D pp3d=(PiePlot3D) plot; pp3d.setDepthFactor(0.10); } //CategoryItemRenderer renderer = plot.getRenderer(); }
/** * Some checks for the equals() method. */ public void testEquals() { PiePlot3D p1 = new PiePlot3D(); PiePlot3D p2 = new PiePlot3D(); assertTrue(p1.equals(p2)); assertTrue(p2.equals(p1)); p1.setDepthFactor(1.23); assertFalse(p1.equals(p2)); p2.setDepthFactor(1.23); assertTrue(p1.equals(p2)); p1.setDarkerSides(true); assertFalse(p1.equals(p2)); p2.setDarkerSides(true); assertTrue(p1.equals(p2)); }
private static JFreeChart createChart(final PieDataset dataset, String str) { final JFreeChart chart = ChartFactory.createPieChart3D( str, // chart title dataset, // data true, // include legend true, false ); final PiePlot3D plot = (PiePlot3D) chart.getPlot(); plot.setStartAngle(290); plot.setDirection(Rotation.CLOCKWISE); plot.setForegroundAlpha(0.5f); StandardPieSectionLabelGenerator labelGenerator = new StandardPieSectionLabelGenerator("{0} {2}"); plot.setLabelGenerator(labelGenerator); plot.setNoDataMessage("No data to display"); return chart; }
private void showVehicleInStore() { DefaultPieDataset dataset = new DefaultPieDataset(); List<Vehicle> vs = vehicleService.getAll(); for (Vehicle vehicle : vs) { if (vehicle.getQuantity() > 0) { dataset.setValue(vehicle.getModelNumber(), vehicle.getQuantity()); } } JFreeChart chart = ChartFactory.createPieChart3D("Vehicle In Store", // chart title dataset, // data true, // include legend true, false); PiePlot3D plot = (PiePlot3D) chart.getPlot(); PieSectionLabelGenerator generator = new StandardPieSectionLabelGenerator( "Model No {0} : {2}({1})", new DecimalFormat("0"), new DecimalFormat("0.00%")); plot.setLabelGenerator(generator); plot.setStartAngle(290); plot.setDirection(Rotation.CLOCKWISE); plot.setForegroundAlpha(0.5f); // we put the chart into a panel ChartPanel chartPanel = new ChartPanel(chart); changePanelReport(chartPanel); }
@Override public void test() { super.test(); numberOfPagesTest(1); JFreeChart chart = getChart("summary.chart1", 0); Plot plot = chart.getPlot(); Assert.assertEquals("plot", PiePlot3D.class, plot.getClass()); Assert.assertTrue("circular", ((PiePlot) plot).isCircular()); Assert.assertEquals("label format", "label {0}", ((StandardPieSectionLabelGenerator) ((PiePlot) plot).getLabelGenerator()).getLabelFormat()); Assert.assertEquals("legend label format", "legend label {0}", ((StandardPieSectionLabelGenerator) ((PiePlot) plot).getLegendLabelGenerator()).getLabelFormat()); Assert.assertEquals("depth factor", 0.5, ((PiePlot3D) plot).getDepthFactor()); chart = getChart("summary.chart2", 0); plot = chart.getPlot(); Assert.assertNull("label format", ((PiePlot) plot).getLabelGenerator()); }