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:com.tocea.scertify.eclipse.scertifycode.ui.stats.views.GraphStatsView.java
/** * Cre le graphe JFreeChart./*from w ww.ja v a 2 s .c o m*/ * * @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:swing.PrincipalMDI.java
private void barMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_barMenuItemActionPerformed // TODO add your handling code here: DefaultPieDataset pieDataSet = new DefaultPieDataset(); pieDataSet.setValue("En attente", cptAttente); pieDataSet.setValue("En cours", cptEnCours); pieDataSet.setValue("Non attribu", cptNonAttribue); pieDataSet.setValue("Resolu", cptResolu); pieDataSet.setValue("A traiter", cptATraiter); JFreeChart chart = ChartFactory.createPieChart3D("Camembert", pieDataSet, true, true, true); PiePlot3D p = (PiePlot3D) chart.getPlot(); //p.setForegroundAlpha(TOP_ALIGNMENT); ChartFrame frame = new ChartFrame("camembert", chart); frame.setVisible(true);/*from w w w .j a va 2 s . com*/ frame.setSize(600, 500); }
From source file:org.emftrace.quarc.ui.views.RatioView.java
/** * create a PieChart for the priorities of the goals * @param dataset the used Dataset// w w w . j a va2 s .c om * @return the created Chart */ private JFreeChart createChart(PieDataset dataset) { JFreeChart chart = ChartFactory.createPieChart3D("priorities of selected goals", // chart // title dataset, // data true, // include legend true, false); final org.jfree.chart.plot.PiePlot3D plot = (org.jfree.chart.plot.PiePlot3D) chart.getPlot(); plot.setStartAngle(290); plot.setDirection(Rotation.CLOCKWISE); plot.setForegroundAlpha(0.5f); plot.setNoDataMessage("No data to display"); plot.setLabelGenerator(new org.jfree.chart.labels.StandardPieSectionLabelGenerator("{0} = {2}", NumberFormat.getNumberInstance(), NumberFormat.getPercentInstance())); return chart; }
From source file:edu.uara.wrappers.customcharts.CustomPieChart.java
@Override public void generate3DPieChart(PieDataset dataset, String seriesName, TableOrder order) { pieDs = dataset;//store dataset for update this.singlePieDatasetSeries = seriesName; tableOrder = order;// w w w . ja v a 2 s .c o m try { if (dataset == null) throw new Exception("No dataset provided"); chart = ChartFactory.createPieChart3D(title, dataset, legend, // legend? false, // no tooltip needed false // mo URL needed ); currentDatasetType = DatasetTypes.PieDataset; } catch (Exception ex) { //handle exception System.out.print("Error Generating 3D pie chart. " + ex.getMessage()); } }
From source file:co.edu.eam.ingesoft.egresados.vista.gui.VentanaReporteEgresadosOcupacion.java
/** * metodo para cargar la grafica de reporte *///from ww w .j a va 2s .c om public void global() { ChartPanel panel; try { List<InformacionLaboral> listaInfoLab = controlador.listarInformacionLaboral(); jPPrimero.removeAll(); jPSegundo.removeAll(); double empleado = 0; double desempleado = 0; double independiente = 0; double empresario = 0; int contadorEmpleado = 0; int contadordDesempleado = 0; int contadorIndependiente = 0; int contadorEmpresario = 0; for (int i = 0; i < listaInfoLab.size(); i++) { if (listaInfoLab.get(i).getSituacionAct().equals(SituacionLaboralEnum.EMPLEADO)) { contadorEmpleado++; } else if (listaInfoLab.get(i).getSituacionAct().equals(SituacionLaboralEnum.DESEMPLEADO)) { contadordDesempleado++; } else if (listaInfoLab.get(i).getSituacionAct().equals(SituacionLaboralEnum.INDEPENDIENTE)) { contadorIndependiente++; } else if (listaInfoLab.get(i).getSituacionAct().equals(SituacionLaboralEnum.EMPRESARIO)) { contadorEmpresario++; } else { JOptionPane.showMessageDialog(null, "No hay empleados registrados"); } empleado = (contadorEmpleado * 100) / listaInfoLab.size(); desempleado = (contadordDesempleado * 100) / listaInfoLab.size(); independiente = (contadorIndependiente * 100) / listaInfoLab.size(); empresario = (contadorEmpresario * 100) / listaInfoLab.size(); } DefaultPieDataset ds = new DefaultPieDataset(); ds.setValue("Empleado: " + empleado + "%", empleado); ds.setValue("Desempleado: " + desempleado + "%", desempleado); ds.setValue("Independiente: " + independiente + "%", independiente); ds.setValue("Empresario: " + empresario + "%", empresario); JFreeChart jf = ChartFactory.createPieChart3D("Reporte de egresados por tipo de ocupacin", ds, true, true, true); panel = new ChartPanel(jf); panel.setBounds(20, 50, 280, 280); jPPrimero.add(panel); } catch (Exception e) { } }
From source file:org.amanzi.splash.chart.Charts.java
private static JFreeChart createPieChart(Chart chart) { return ChartFactory.createPieChart3D("", ((PiePlot) chart.getPlot()).getDataset(), true, true, true); }
From source file:org.tiefaces.components.websheet.chart.ChartHelper.java
/** * create pie 3d chart.//from w w w. j a v a 2s.c o m * * @param chartData * chart data. * @return jfreechart. */ public JFreeChart createPie3DChart(final ChartData chartData) { // create the chart... final JFreeChart chart = ChartFactory.createPieChart3D(getPieTitle(chartData), // chart title createPieDataset(chartData), // data true, // include legend false, // tooltips false // urls ); setupPieStyle(chart, chartData); return chart; }
From source file:graficoyoutube.Grafico.java
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed // TODO add your handling code here: ChartPanel panel;/*from w ww . j a va2 s .co m*/ JFreeChart chart = null; if (l.isSelected()) { //Graficas de Lineas int validar = 1; XYSplineRenderer renderer = new XYSplineRenderer(); XYSeriesCollection dataset = new XYSeriesCollection(); ValueAxis x = new NumberAxis(); ValueAxis y = new NumberAxis(); XYSeries serie = new XYSeries("Datos"); XYPlot plot; lineas.removeAll(); try { for (int fila = 0; fila <= datos.getRowCount(); fila++) { serie.add(Float.parseFloat(String.valueOf(datos.getValueAt(fila, 0))), Float.parseFloat(String.valueOf(datos.getValueAt(fila, 1)))); //JOptionPane.showMessageDialog(this,datos.getValueAt(fila, 0)+" ,"+ datos.getValueAt(fila, 1)); } } catch (Exception ex) { validar = 0; JOptionPane.showMessageDialog(this, ex.getMessage() + "\n" + validar); } if (validar == 1) { dataset.addSeries(serie); x.setLabel("Eje X"); y.setLabel("Eje Y"); plot = new XYPlot(dataset, x, y, renderer); chart = new JFreeChart(plot); chart.setTitle("Grafico de Lineas YouTube"); } else { JOptionPane.showMessageDialog(this, "Debe llenar la tabla con datos numericos"); } } else { if (b.isSelected()) { //Grafico de Barras DefaultCategoryDataset data = new DefaultCategoryDataset(); String producto1 = "Sopas"; String producto2 = "Soda"; String dia1 = "Dia 1"; String dia2 = "Dia 2"; String dia3 = "Dia 3"; String dia4 = "Dia 4"; data.addValue(18, producto1, dia1); data.addValue(15, producto1, dia2); data.addValue(14, producto1, dia3); data.addValue(1, producto1, dia4); data.addValue(50, producto2, dia1); data.addValue(45, producto2, dia2); data.addValue(31, producto2, dia3); data.addValue(10, producto2, dia4); chart = ChartFactory.createBarChart("Grafico de Barras YouTube", "Dia", "Cantidad", data, PlotOrientation.HORIZONTAL, true, true, true); CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setDomainGridlinesVisible(true); } else { //Grafico de Pastel DefaultPieDataset data = new DefaultKeyedValuesDataset(); data.setValue("Categoria 1", 20); data.setValue("Categoria 2", 60); data.setValue("Categoria 3", 20); chart = ChartFactory.createPieChart3D("Grafico de Pastel", data, true, true, true); } } panel = new ChartPanel(chart); panel.setBounds(5, 10, 410, 400); if (l.isSelected()) { //Lineas lineas.add(panel); lineas.repaint(); } else { if (b.isSelected()) { barras.add(panel); barras.repaint(); } else { pastel.add(panel); pastel.repaint(); } } }
From source file:com.indicator_engine.controller.GraphController.java
private JFreeChart createPieChart(final PieDataset pdSet, final String chartTitle) { JFreeChart chart = ChartFactory.createPieChart3D(chartTitle, pdSet, true, true, false); PiePlot3D plot = (PiePlot3D) chart.getPlot(); plot.setStartAngle(290);//from w w w . ja v a 2s . c om plot.setDirection(Rotation.CLOCKWISE); plot.setForegroundAlpha(0.5f); PieSectionLabelGenerator gen = new StandardPieSectionLabelGenerator("{0}: {1} ({2})", new DecimalFormat("0"), new DecimalFormat("0%")); plot.setLabelGenerator(gen); return chart; }
From source file:org.adempiere.webui.dashboard.CalendarWindow.java
private void syncModel() { Hashtable<String, BigDecimal> ht = new Hashtable<String, BigDecimal>(); List<?> list = calendars.getModel().get(calendars.getBeginDate(), calendars.getEndDate(), null); int size = list.size(); for (Iterator<?> it = list.iterator(); it.hasNext();) { String key = ((ADCalendarEvent) it.next()).getR_RequestType_ID() + ""; if (!ht.containsKey(key)) ht.put(key, BigDecimal.ONE); else {//from w w w . j a v a 2s. c o m BigDecimal value = ht.get(key); ht.put(key, value.add(BigDecimal.ONE)); } } Hashtable<Object, String> htTypes = new Hashtable<Object, String>(); for (int i = 0; i < lbxRequestTypes.getItemCount(); i++) { Listitem li = lbxRequestTypes.getItemAtIndex(i); if (li != null && li.getValue() != null) htTypes.put(li.getValue(), li.getLabel()); } DefaultPieDataset pieDataset = new DefaultPieDataset(); Enumeration<?> keys = ht.keys(); while (keys.hasMoreElements()) { String key = (String) keys.nextElement(); BigDecimal value = ht.get(key); String name = (String) htTypes.get(key); pieDataset.setValue(name == null ? "" : name, new Double(size > 0 ? value.doubleValue() / size * 100 : 0)); } JFreeChart chart = ChartFactory.createPieChart3D(Msg.getMsg(Env.getCtx(), "EventsAnalysis"), pieDataset, true, true, true); PiePlot3D plot = (PiePlot3D) chart.getPlot(); plot.setForegroundAlpha(0.5f); BufferedImage bi = chart.createBufferedImage(600, 250); try { byte[] bytes = EncoderUtil.encode(bi, ImageFormat.PNG, true); AImage image = new AImage("Pie Chart", bytes); myChart.setContent(image); } catch (IOException e) { e.printStackTrace(); } htTypes = null; ht = null; }