List of usage examples for org.jfree.chart.plot PiePlot3D setLabelGap
public void setLabelGap(double gap)
From source file:edu.wpi.cs.wpisuitetng.modules.requirementmanager.view.requirements.NewPieChartPanel.java
/** * @param dataset/*from w w w .j a v a 2s .c om*/ * the data to be displayed by the pie chart * @param title * the title of the chart @return the pie chart to be displayed */ private static 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();// 3D pie chart. the cats // are going to love // this. plot.setLabelFont(new Font("SansSerif", Font.PLAIN, 12)); plot.setNoDataMessage("No data available"); plot.setCircular(true); plot.setLabelGap(0.02); plot.setStartAngle(270); plot.setDirection(Rotation.ANTICLOCKWISE); //Rotator rotator = new Rotator(plot); //rotator.start(); return chart; }
From source file:org.gvsig.symbology.fmap.symbols.PieChart3DSymbol.java
protected Plot getOutlinePlot() { if (outlinePlot == null) { PiePlot3D myMapPlot = new PiePlot3D(); myMapPlot.setLabelGap(0); myMapPlot.setIgnoreZeroValues(ignoreZeroValues); updateDataset();//w w w . j ava2 s .c om myMapPlot.setDataset(new DefaultPieDataset(dataset)); myMapPlot.setDirection(clockwise ? Rotation.CLOCKWISE : Rotation.ANTICLOCKWISE); myMapPlot.setDepthFactor(depthFactor); myMapPlot.setMinimumArcAngleToDraw(minimumAngleToDraw); myMapPlot.setCircular(circular); myMapPlot.setStartAngle(getRotation()); /* * myMapPlot.setDarkerSides(false); // requires jfreechart 1.0.10 * myMapPlot.setForegroundAlpha(foregroundAlpha); // requires * jfreechart 1.0.10 */ outlinePlot = myMapPlot; } return outlinePlot; }
From source file:loansystem.visual.panel.StartPage.java
private void graficoPorEstado() { ArrayList<GraficoEntidad> graficos; graficos = gDao.obtenerPrestamosPorEstado(); DefaultPieDataset data = new DefaultPieDataset(); if (graficos.size() > 0) { for (GraficoEntidad result : graficos) { //datos.setValue(result.getValor(), result.getSerie(), result.getValorEje()); data.setValue(result.getValorEje(), result.getValor()); }/*w w w.j a v a 2 s . c o m*/ //dibujarGrafico(datos, BAR, "Otorgado vs Recuperado", "Moneda", "Monto",PlotOrientation.VERTICAL,pnelOtorgadoRecuperado); // Creando el Grafico /*JFreeChart grafica = ChartFactory.createPieChart( "Prstamos por Estado", data, true, true, false);*/ JFreeChart grafica = ChartFactory.createPieChart3D("Prstamos por Estado", data, true, true, false); grafica.setBackgroundPaint(Color.white); PiePlot3D plot = (PiePlot3D) grafica.getPlot(); plot.setForegroundAlpha(0.6f); plot.setCircular(true); plot.setLabelGap(0.01); plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0} {1} ({2})")); plot.setBackgroundPaint(null); // Mostrar Grafico ChartPanel panel = new ChartPanel(grafica); pnelPorEstado.add(panel); pnelPorEstado.revalidate(); pnelPorEstado.repaint(); } }
From source file:kcse_2013_results.Pie_Chart_KCSE_School_Performance.java
/** * Creates a chart./*from w ww .j a va 2 s.co m*/ * * @param dataset the dataset. * * @return A chart. */ public JFreeChart createChart(PieDataset dataset) { JFreeChart chart = ChartFactory.createPieChart3D("KCSE 2013 Results Summary ", // chart title dataset, // data true, // include legend true, false); PiePlot3D plot = (PiePlot3D) chart.getPlot(); plot.setLabelFont(new Font("SansSerif", Font.PLAIN, 12)); plot.setNoDataMessage("No data available"); plot.setForegroundAlpha(0.95f); plot.setCircular(true); plot.setLabelGap(0.02); return chart; }
From source file:de.xirp.chart.ChartManager.java
/** * Returns a pie chart. The chart is generated from the given * {@link de.xirp.db.Record} and key array. The flag * <code>relative</code> indicated whether or not relative * values should be used.//from w w w. j a va2 s.c o m * * @param record * The record containing the data. * @param keys * The keys to use. * @param relative * Flag indicating if relative values should be used. * @return A pie chart. * @see org.jfree.chart.JFreeChart * @see de.xirp.db.Record */ private static JFreeChart createPieChart(Record record, String[] keys, boolean relative) { String chartTitle = (relative ? I18n.getString("ChartManager.text.relative") //$NON-NLS-1$ : I18n.getString("ChartManager.text.absolute")) //$NON-NLS-1$ + I18n.getString("ChartManager.text.occurencesOfKey") + record.getName() + ": "; //$NON-NLS-1$ //$NON-NLS-2$ DefaultPieDataset dataset = new DefaultPieDataset(); Map<String, Long> values; values = ChartDatabaseUtil.getValuesForRecord(record, keys, relative); for (String s : values.keySet()) { dataset.setValue(s, values.get(s)); } JFreeChart chart; if (options.is(OptionName.THREE_D)) { chart = ChartFactory.createPieChart3D(chartTitle, dataset, true, true, false); PiePlot3D plot = (PiePlot3D) chart.getPlot(); plot.setStartAngle(290); plot.setDirection(Rotation.CLOCKWISE); plot.setForegroundAlpha(0.5f); plot.setNoDataMessage(NO_DATA_AVAILABLE); plot.setLabelGenerator(new CustomLabelGenerator(options)); } else { chart = ChartFactory.createPieChart(chartTitle, dataset, true, true, false); PiePlot plot = (PiePlot) chart.getPlot(); plot.setSectionOutlinesVisible(true); plot.setNoDataMessage(NO_DATA_AVAILABLE); plot.setCircular(false); plot.setLabelGap(0.02); plot.setLabelGenerator(new CustomLabelGenerator(options)); } exportAutomatically(null, chart); return chart; }
From source file:edu.wpi.cs.wpisuitetng.modules.requirementsmanager.view.charts.StatView.java
/** * method to update the displayed chart based on the user's selection *///from ww w .j a v a 2 s . c om public void updateChart() { JFreeChart chart = null; AbstractRequirementStatistics stats = null; // initialize the stats based on the type of data which the user has // selected switch (chartDataType) { case STATUS: stats = new StatusRequirementStatistics(); break; case ITERATION: stats = new IterationRequirementStatistics(); break; case ASSIGNEE: stats = new AssigneeRequirementStatistics(); break; case ESTIMATES: stats = new EstimateRequirementStatistics(); break; case EFFORT: stats = new ActualRequirementStatistics(); break; case VELOCITY: stats = new VelocityIterationStatistics(); break; case TASK: stats = new TaskRequirementStatistics(); break; default: // if you encounter this default statement, it means that new // values // have been // added to the DataType enum, but nobody has modified this poor // little method } // build the chart based on the type of chart the user has selected switch (chartType) { case BAR: // TODO: determine if additional modifications need to be // made // to the plot chart = stats.buildBarChart(); final CategoryPlot barPlot = (CategoryPlot) chart.getPlot(); barPlot.setNoDataMessage("No data available"); break; case PIE: chart = stats.buildPieChart(); final PiePlot3D piePlot = (PiePlot3D) chart.getPlot(); piePlot.setLabelFont(new Font("SansSerif", Font.PLAIN, 12)); piePlot.setNoDataMessage("No data available"); piePlot.setCircular(true); piePlot.setLabelGap(0.02); piePlot.setForegroundAlpha(0.7f); final PieSectionLabelGenerator generator = new StandardPieSectionLabelGenerator("{0} = {1} ({2})"); piePlot.setLabelGenerator(generator); break; case LINE: chart = stats.buildLineChart(); final CategoryPlot linePlot = (CategoryPlot) chart.getPlot(); linePlot.setNoDataMessage("No data available"); default: // if you encounter this default statement, it means that new // values have been added to the ChartType enum, but nobody has // modified this poor little method } // add the newly generated chart to the panel final JSplitPane mainPane = (JSplitPane) getComponent(0); final ChartPanel chartPanel = (ChartPanel) mainPane.getLeftComponent(); chartPanel.setChart(chart); return; }
From source file:com.tocea.scertify.eclipse.scertifycode.ui.stats.views.GraphStatsView.java
/** * Cre le graphe JFreeChart.// w ww .j a va 2s .com * * @param piedataset * : la source de donnes afficher * @return le diagramme */ private JFreeChart createChart(final GraphPieDataset piedataset) { final JFreeChart jfreechart = ChartFactory.createPieChart3D(null, piedataset, false, true, false); jfreechart.setAntiAlias(true); jfreechart.setTextAntiAlias(true); final PiePlot3D pieplot3d = (PiePlot3D) 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.setBackgroundAlpha(0.0F); pieplot3d.setNoDataMessage(Messages.GraphStatsView_noDataToDisplay); 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); pieplot3d.setInteriorGap(0.02); pieplot3d.setMaximumLabelWidth(0.20); return jfreechart; }
From source file:edu.ucla.stat.SOCR.chart.ChartGenerator_JTable.java
private JFreeChart createPieChart(String titleLabel, PieDataset dataset) { // System.out.println("rotation="+rotation); if (dimension.equalsIgnoreCase("3D")) { JFreeChart chart = ChartFactory.createPieChart3D(titleLabel, // chart title dataset, // data true, // include legend true, false);// w w w. ja v a2 s . c o m PiePlot3D plot = (PiePlot3D) chart.getPlot(); if (rotation.equalsIgnoreCase("clockwise")) { plot.setStartAngle(290); plot.setDirection(Rotation.CLOCKWISE); Rotator rotator = new Rotator(plot); rotator.start(); } else if (rotation.equalsIgnoreCase("counter_clockwise")) { plot.setStartAngle(290); plot.setDirection(Rotation.ANTICLOCKWISE); Rotator rotator = new Rotator(plot); rotator.start(); } plot.setForegroundAlpha(0.5f); plot.setNoDataMessage("No data to display"); return chart; } //end of 3D //2D ring if (rotation.equalsIgnoreCase("ring")) { JFreeChart chart = ChartFactory.createRingChart(titleLabel, // chart title dataset, // data false, // include legend true, false); RingPlot plot = (RingPlot) chart.getPlot(); plot.setLabelFont(new Font("SansSerif", Font.PLAIN, 12)); plot.setNoDataMessage("No data available"); plot.setCircular(false); plot.setLabelGap(0.02); return chart; } //2D JFreeChart chart = ChartFactory.createPieChart(titleLabel, // chart title dataset, // data true, // include legend true, false); TextTitle title = chart.getTitle(); title.setToolTipText("A title tooltip!"); PiePlot plot = (PiePlot) chart.getPlot(); if (rotation.equalsIgnoreCase("clockwise")) { plot.setStartAngle(290); plot.setDirection(Rotation.CLOCKWISE); Rotator rotator = new Rotator(plot); rotator.start(); } else if (rotation.equalsIgnoreCase("counter_clockwise")) { plot.setStartAngle(290); plot.setDirection(Rotation.ANTICLOCKWISE); Rotator rotator = new Rotator(plot); rotator.start(); } plot.setLabelFont(new Font("SansSerif", Font.PLAIN, 12)); plot.setNoDataMessage("No data available"); plot.setCircular(false); plot.setLabelGap(0.02); return chart; }