List of usage examples for org.jfree.chart ChartFactory createPieChart3D
public static JFreeChart createPieChart3D(String title, PieDataset dataset, boolean legend, boolean tooltips, boolean urls)
From source file:org.operamasks.faces.render.graph.PieChartRenderer.java
protected JFreeChart createChart(UIChart comp) { Dataset dataset = createDataset(comp); JFreeChart chart = null;/*from w ww . j a v a 2s . c o m*/ PiePlot pieplot = null; boolean ring = Coercion.coerceToBoolean(comp.getAttributes().get("ring")); if (dataset instanceof CategoryDataset) { CategoryDataset catset = (CategoryDataset) dataset; if (catset.getRowCount() == 1) { PieDataset pieset = new CategoryToPieDataset(catset, TableOrder.BY_ROW, 0); if (ring) { chart = ChartFactory.createRingChart(null, pieset, false, false, false); } else if (comp.isEffect3D()) { chart = ChartFactory.createPieChart3D(null, pieset, false, false, false); } else { chart = ChartFactory.createPieChart(null, pieset, false, false, false); } pieplot = (PiePlot) chart.getPlot(); } else { if (comp.isEffect3D()) { chart = ChartFactory.createMultiplePieChart3D(null, catset, TableOrder.BY_ROW, false, false, false); } else { chart = ChartFactory.createMultiplePieChart(null, catset, TableOrder.BY_ROW, false, false, false); } pieplot = (PiePlot) ((MultiplePiePlot) chart.getPlot()).getPieChart().getPlot(); } } if (pieplot != null) { if (!comp.isDrawItemLabel()) { pieplot.setLabelGenerator(null); } if (comp.isShowItemTips()) { pieplot.setToolTipGenerator(new StandardPieToolTipGenerator()); } Object startAngle = comp.getAttributes().get("startAngle"); if (startAngle != null) { pieplot.setStartAngle(Coercion.coerceToDouble(startAngle)); } } return chart; }
From source file:gui.images.ClassifierResultPanel.java
/** * Sets the new results for display./*from w ww . ja v a 2 s .c om*/ * * @param prediction Float array corresponding to the classifier prediction. * @param classifierName String that is the classifier name. * @param classColors Color array representing the class color. * @param classNames String array representing the class names. */ public void setResults(float[] prediction, String classifierName, Color[] classColors, String[] classNames) { int numClasses = classNames.length; DefaultPieDataset pieData = new DefaultPieDataset(); for (int cIndex = 0; cIndex < numClasses; cIndex++) { pieData.setValue(classNames[cIndex], prediction[cIndex]); } JFreeChart chart = ChartFactory.createPieChart3D(classifierName + " prediction", pieData, true, true, false); PiePlot plot = (PiePlot) chart.getPlot(); plot.setDirection(Rotation.CLOCKWISE); plot.setForegroundAlpha(0.5f); PieRenderer prend = new PieRenderer(classColors); prend.setColor(plot, pieData); ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new Dimension(140, 140)); resultChartPanel.removeAll(); resultChartPanel.add(chartPanel); resultChartPanel.revalidate(); resultChartPanel.repaint(); }
From source file:fr.paris.lutece.plugins.form.business.GraphTypePieChart.java
/** * return the PieChartGraph JFreeChart graph * @param listStatistic listStatistic// w w w .j av a 2s . c o m * @param strGraphTitle graph title * @param nGraphThreeDimension true if the graph must be in three dimension * @param nGraphLabelValue true if the labels must appear in the graph * @return the JFreeChart graph associate to the graph type */ public static JFreeChart createPieChartGraph(List<StatisticEntrySubmit> listStatistic, String strGraphTitle, boolean nGraphThreeDimension, boolean nGraphLabelValue) { PieDataset pieDataset = createPieDataset(listStatistic); JFreeChart chart; if (nGraphThreeDimension) { chart = ChartFactory.createPieChart3D(strGraphTitle, pieDataset, true, true, false); } else { chart = ChartFactory.createPieChart(strGraphTitle, pieDataset, true, true, false); } PiePlot plot = (PiePlot) chart.getPlot(); if (nGraphLabelValue) { plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{2}")); } else { plot.setLabelGenerator(null); } return chart; }
From source file:org.pentaho.reporting.engine.classic.demo.ancient.demo.chartdemo.BasicExtXmlChartDemo.java
/** * Creates a sample chart./* w ww . ja va 2s. 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 1", // chart title dataset, // data true, // include legend true, false); // set the background color for the chart... chart.setBackgroundPaint(Color.yellow); final PiePlot3D plot = (PiePlot3D) chart.getPlot(); plot.setStartAngle(270); // plot.setDirection(Rotation.CLOCKWISE); plot.setForegroundAlpha(0.5f); plot.setNoDataMessage("No data to display"); return chart; }
From source file:esprit.rt.gui.StatistiquesRestaurateur.java
/** * Creates new form StatistiquesRestaurateur *//*from w w w .j a v a 2s. co m*/ public StatistiquesRestaurateur() { initComponents(); setLocationRelativeTo(null); dataset = new DefaultPieDataset(); //Statique PieSectionLabelGenerator gen = new StandardPieSectionLabelGenerator("{0}: {1} places rservs ({2})", new DecimalFormat("0"), new DecimalFormat("0%")); PieSectionLabelGenerator gen2 = new StandardPieSectionLabelGenerator("{0}: {1} DT de revenue ({2})", new DecimalFormat("0"), new DecimalFormat("0%")); for (Entry e : new StatistiqueDAO().mostBooked().entrySet()) { if (Float.parseFloat((String) e.getValue()) > max1) { i1 = j; max1 = Float.parseFloat((String) e.getValue()); } dataset.setValue((Comparable) e.getKey(), Float.parseFloat((String) e.getValue())); j++; } graphe = ChartFactory.createPieChart3D("Les restaurant les plus rserv", dataset, true, true, false); PiePlot plot = (PiePlot) graphe.getPlot(); plot.setLabelGenerator(gen); cp = new ChartPanel(graphe); cp.setBounds(new Rectangle(490, 400)); PieChart.getContentPane().add(cp); cp.setVisible(true); PieChart.setVisible(true); title.setHorizontalAlignment(JLabel.CENTER); try { title.setFont(new FontsPartieRestaurateur().getFont(FontsPartieRestaurateur.TITLE, 70)); } catch (FontFormatException ex) { Logger.getLogger(ConsultRestaurant.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(ConsultRestaurant.class.getName()).log(Level.SEVERE, null, ex); } dataset2 = new DefaultPieDataset(); //Statique for (Entry e : new StatistiqueDAO().mostPayed().entrySet()) { if (Float.parseFloat((String) e.getValue()) > max2) { i2 = k; max2 = Float.parseFloat((String) e.getValue()); } dataset2.setValue((Comparable) e.getKey(), Float.parseFloat((String) e.getValue())); k++; } graphe2 = ChartFactory.createPieChart3D("Restaurant avec le meilleur revenue", dataset2, true, true, false); PiePlot plot2 = (PiePlot) graphe2.getPlot(); plot2.setLabelGenerator(gen2); cp2 = new ChartPanel(graphe2); cp2.setBounds(new Rectangle(490, 400)); Pie2.add(cp2); cp2.setVisible(true); Pie2.setVisible(true); try { if (i1 == i2) { conseil.setForeground(Color.green); conseil.setText( "Vos statistiques sont parfaites! Votre restaurant le plus rserv est celui avec le plus de revenue!"); } else { conseil.setForeground(Color.red); conseil.setText( "Le restaurant le plus rserv n'est pas celui avec le plus revenue! Verifier votre stratgie de prix!"); } } catch (Exception e) { conseil.setVisible(false); } }
From source file:com.esofthead.mycollab.community.ui.chart.PieChartWrapper.java
@Override protected JFreeChart createChart() { // create the chart... pieDataSet = createDataset();/* www . j a va2 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:BrowserAverage.java
private JFreeChart createChart(PieDataset dataset, String title) { JFreeChart chart = ChartFactory.createPieChart3D(title, dataset, true, true, false); PiePlot3D plot = (PiePlot3D) chart.getPlot(); plot.setStartAngle(0);/*from w w w . ja v a2 s .c o m*/ plot.setDirection(Rotation.ANTICLOCKWISE); plot.setForegroundAlpha(0.5f); rotator = new Rotator(plot, 0); rotator.start(); return chart; }
From source file:Interfaz.ClienteReporte.java
public ClienteReporte(ClienteVentana parent) { this.parent = parent; initComponents();//from w ww .jav a 2s .c o m setLocationRelativeTo(null); // Fuente de Datos defaultpiedataset = new DefaultPieDataset(); defaultpiedataset.setValue("Total de Tickets Liberados", (Integer.parseInt(lrecibidos.getText()) - Integer.parseInt(lefectivos.getText()))); defaultpiedataset.setValue("Tickets Atendidos Satisfactoriamente", Integer.parseInt(lefectivos.getText())); //defaultpiedataset.setValue("Hacking", new Double(19.5D)); //defaultpiedataset.setValue("SEO", new Double(30.5D)); //defaultpiedataset.setValue("Redes", new Double(2.0D)); // Creando el Grafico chart = ChartFactory.createPieChart3D("Mi Proporcin", defaultpiedataset, true, true, false); PiePlot3D pieplot3d = (PiePlot3D) chart.getPlot(); pieplot3d.setDepthFactor(0.5); pieplot3d.setStartAngle(290D); pieplot3d.setDirection(Rotation.CLOCKWISE); pieplot3d.setForegroundAlpha(0.5F); // Mostrar Grafico chartPanel = new ChartPanel(chart); chartPanel.setBounds(0, 0, 314, 270); jpGrafico.add(chartPanel); this.setVisible(true); }
From source file:Vista.CuentasCobrar.java
private JFreeChart createChart(PieDataset dataset, String title) { JFreeChart chart = ChartFactory.createPieChart3D(title, // chart title dataset, // data true, // include legend true, false);/*from www . j a va 2s .c om*/ //chart.getLegend(); PiePlot3D plot = (PiePlot3D) chart.getPlot(); plot.setStartAngle(290); plot.setDirection(Rotation.CLOCKWISE); plot.setForegroundAlpha(0.5f); return chart; }
From source file:com.chris.brkopani.gui.analytics.Graph.java
/** * * Creates a chart// w w w . java 2 s . com */ 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.setSectionPaint("...-20", new Color(195, 203, 113)); plot.setSectionPaint("21-30", new Color(174, 90, 65)); plot.setSectionPaint("35-...", new Color(85, 158, 131)); plot.setDirection(Rotation.CLOCKWISE); plot.setForegroundAlpha(0.5f); return chart; }