List of usage examples for org.jfree.chart.plot PiePlot3D setLabelGenerator
public void setLabelGenerator(PieSectionLabelGenerator generator)
From source file:unikn.dbis.univis.visualization.chart.PieChart.java
/** * Makes the plot./* ww w.j a v a2 s . c o m*/ */ protected void plot() { PiePlot3D plot = (PiePlot3D) getChart().getPlot(); plot.setStartAngle(290); plot.setDirection(Rotation.CLOCKWISE); plot.setForegroundAlpha(0.5f); plot.setNoDataMessage("No data available"); plot.setLabelGenerator(null); plot.setLegendLabelGenerator(new LabelGenerator(createTotal())); }
From source file:org.jfree.chart.demo.PieChart3DDemo4.java
/** * Creates a sample chart./*from w w w .j a v a 2 s . c o m*/ * * @param dataset the dataset. * * @return A chart. */ private JFreeChart createChart(final PieDataset dataset) { final JFreeChart chart = ChartFactory.createPieChart3D("Pie Chart 3D Demo 4", // 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); plot.setNoDataMessage("No data to display"); plot.setLabelGenerator(new CustomLabelGenerator()); return chart; }
From source file:edu.ucla.stat.SOCR.chart.demo.PieChart3DDemo3.java
/** * Creates a sample chart./*from w ww . j a v a2s .co m*/ * * @param dataset the dataset. * * @return A chart. */ protected JFreeChart createChart(PieDataset dataset) { JFreeChart chart = ChartFactory.createPieChart3D(chartTitle, // chart title dataset, // data !legendPanelOn, // include legend true, false); PiePlot3D plot = (PiePlot3D) chart.getPlot(); plot.setStartAngle(290); plot.setDirection(Rotation.CLOCKWISE); plot.setForegroundAlpha(0.5f); plot.setNoDataMessage("No data to display"); plot.setLabelGenerator(new CustomPieSectionLabelGenerator()); for (int i = 0; i < pulloutFlag.length; i++) { //System.out.println("\""+pulloutFlag[i]+"\""); if (pulloutFlag[i].equals("1")) { Comparable key = dataset.getKey(i); plot.setExplodePercent(key, 0.30); } } if (rotateOn) { Rotator rotator = new Rotator(plot); rotator.start(); } setCategorySummary(dataset); return chart; }
From source file:edu.smc.mediacommons.panels.PasswordPanel.java
private JFreeChart createChart(final PieDataset dataset) { final JFreeChart chart = ChartFactory.createPieChart3D("Password Pie Chart", // chart title dataset, // data true, // include legend true, false);// w w w . ja v a2 s . c om final PiePlot3D plot = (PiePlot3D) chart.getPlot(); plot.setStartAngle(290); plot.setDirection(Rotation.CLOCKWISE); plot.setForegroundAlpha(0.5f); plot.setNoDataMessage("No data to display"); plot.setLabelGenerator(new CustomLabelGenerator()); return chart; }
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()); }//from ww w . jav a 2 s . c om //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:com.esofthead.mycollab.community.ui.chart.PieChartWrapper.java
@Override protected JFreeChart createChart() { // create the chart... pieDataSet = createDataset();/* w ww . jav a 2 s.c o m*/ final JFreeChart chart = ChartFactory.createPieChart3D("", // chart // title pieDataSet, // data false, // include legend true, // tooltips? false // URLs? ); // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... chart.getTitle().setPaint(new Color(0x5E5E5E)); chart.setBorderVisible(false); // set the background color for the chart... final PiePlot3D plot = (PiePlot3D) chart.getPlot(); plot.setOutlineVisible(false); plot.setInsets(RectangleInsets.ZERO_INSETS); plot.setStartAngle(290); plot.setBackgroundPaint(Color.white); plot.setDirection(Rotation.CLOCKWISE); plot.setForegroundAlpha(0.5f); plot.setNoDataMessage("No data to display"); plot.setLabelGenerator(new JFreeChartLabelCustom()); final List keys = pieDataSet.getKeys(); for (int i = 0; i < keys.size(); i++) { final Comparable key = (Comparable) keys.get(i); plot.setSectionPaint(key, Color.decode( "0x" + GenericChartWrapper.CHART_COLOR_STR[i % GenericChartWrapper.CHART_COLOR_STR.length])); } // OPTIONAL CUSTOMISATION COMPLETED. return chart; }
From source file:net.nosleep.superanalyzer.analysis.views.EncodingKindView.java
private void createChart() { _chart = ChartFactory.createPieChart3D(Misc.getString("KINDS_OF_MUSIC_FILES"), _dataset, false, true, false);//w ww.j a va 2 s . com PiePlot3D plot = (PiePlot3D) _chart.getPlot(); plot.setDarkerSides(true); plot.setStartAngle(PieRotator.angle); plot.setDirection(Rotation.CLOCKWISE); plot.setForegroundAlpha(0.5f); plot.setNoDataMessage("No data to display"); plot.setInsets(new RectangleInsets(10, 10, 10, 10)); plot.setOutlineVisible(false); plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0} ({2})")); _chart.addSubtitle(HomePanel.createSubtitle(Misc.getString("KINDS_OF_MUSIC_FILES_SUBTITLE"))); ChartUtilities.applyCurrentTheme(_chart); plot.setBackgroundPaint(Color.white); _chart.setBorderVisible(false); plot.setIgnoreZeroValues(true); // plot.setAutoPopulateSectionPaint(false); // Misc.formatChart(plot); }
From source file:com.estate.pdf.Page.java
protected void drawTaxPie(Rectangle rct, double totalValue, double tax, String taxLabel, String netLabel) { double taxPercent = (tax / totalValue) * 100; double netValuePercent = 100 - taxPercent; DefaultPieDataset dataset = new DefaultPieDataset(); dataset.setValue(taxLabel, taxPercent); dataset.setValue(netLabel, netValuePercent); PiePlot3D plot = new PiePlot3D(dataset); plot.setLabelGenerator(new StandardPieItemLabelGenerator()); plot.setInsets(new Insets(0, 5, 5, 5)); plot.setToolTipGenerator(new CustomeGenerators.CustomToolTipGenerator()); plot.setLabelGenerator(new CustomeGenerators.CustomLabelGenerator()); plot.setSectionPaint(0, new Color(pgRed)); plot.setSectionPaint(1, new Color(pgGreen)); plot.setForegroundAlpha(.6f);/*from w w w.j a va 2 s .c o m*/ plot.setOutlinePaint(Color.white); plot.setBackgroundPaint(Color.white); JFreeChart chart = new JFreeChart("", JFreeChart.DEFAULT_TITLE_FONT, plot, true); chart.setBackgroundPaint(Color.white); chart.setAntiAlias(true); Rectangle page = rct; try { Image img = Image.getInstance(chart.createBufferedImage((int) page.getWidth(), (int) page.getHeight()), null); drawDiagram(img, rct, 0, 72); } catch (Exception e) { System.out.println(e.getMessage()); } }
From source file:net.nosleep.superanalyzer.analysis.views.RatingView.java
private void createChart() { _chart = ChartFactory.createPieChart3D(Misc.getString("SONG_RATINGS"), _dataset, false, true, false); PiePlot3D plot = (PiePlot3D) _chart.getPlot(); plot.setDarkerSides(true);//from ww w . j a v a 2 s . c o m plot.setStartAngle(PieRotator.angle); plot.setDirection(Rotation.CLOCKWISE); plot.setForegroundAlpha(0.5f); plot.setNoDataMessage(Misc.getString("NO_DATA_TO_DISPLAY")); plot.setInsets(new RectangleInsets(10, 10, 10, 10)); plot.setOutlineVisible(false); plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0} ({2})")); _chart.addSubtitle(HomePanel.createSubtitle(Misc.getString("SONG_RATINGS_SUBTITLE"))); ChartUtilities.applyCurrentTheme(_chart); plot.setBackgroundPaint(Color.white); _chart.setBorderVisible(false); }
From source file:com.esofthead.mycollab.ui.chart.PieChartWrapper.java
@Override protected JFreeChart createChart() { // create the chart... pieDataSet = createDataset();/*w w w . j a va 2 s .c om*/ final JFreeChart chart = ChartFactory.createPieChart3D("", // chart // title pieDataSet, // data false, // include legend true, // tooltips? false // URLs? ); // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... chart.getTitle().setPaint(new Color(0x5E5E5E)); chart.setBorderVisible(false); // set the background color for the chart... final PiePlot3D plot = (PiePlot3D) chart.getPlot(); plot.setOutlineVisible(false); plot.setInsets(RectangleInsets.ZERO_INSETS); plot.setStartAngle(290); plot.setBackgroundPaint(Color.white); plot.setDirection(Rotation.CLOCKWISE); plot.setForegroundAlpha(0.5f); plot.setNoDataMessage("No data to display"); plot.setLabelGenerator(new JFreeChartLabelCustom()); final List keys = pieDataSet.getKeys(); for (int i = 0; i < keys.size(); i++) { final Comparable key = (Comparable) keys.get(i); int colorIndex = i % CHART_COLOR_STR.size(); plot.setSectionPaint(key, Color.decode("0x" + CHART_COLOR_STR.get(colorIndex))); } // OPTIONAL CUSTOMISATION COMPLETED. return chart; }