List of usage examples for org.jfree.chart ChartFactory createPieChart
public static JFreeChart createPieChart(String title, PieDataset dataset, boolean legend, boolean tooltips, boolean urls)
From source file:DAO.graphics.StatConge.java
private static JFreeChart createChart(PieDataset dataset) { JFreeChart chart = ChartFactory.createPieChart("Statistique conge", // chart title dataset, // data true, // include legend true, false);/* w ww. j a v a2 s .c om*/ return chart; }
From source file:pingsnmpapp.classPieGraph.java
public JFreeChart createChart(PieDataset dataset) { JFreeChart chart = ChartFactory.createPieChart("Grfica de Disco", // chart title dataset, // data true, // include legend true, false);/*from w w w . j a va2s . c o m*/ PiePlot plot = (PiePlot) chart.getPlot(); plot.setLabelFont(new Font("SansSerif", Font.PLAIN, 12)); plot.setNoDataMessage("No data available"); plot.setCircular(false); plot.setLabelGap(0.02); return chart; }
From source file:org.jfree.chart.demo.LegendWrapperDemo1.java
private static JFreeChart createChart(PieDataset piedataset) { JFreeChart jfreechart = ChartFactory.createPieChart("Legend Wrapper Demo 1", piedataset, false, true, false);/*from w ww .ja v a 2s .com*/ PiePlot pieplot = (PiePlot) jfreechart.getPlot(); pieplot.setLabelFont(new Font("SansSerif", 0, 12)); pieplot.setNoDataMessage("No data available"); pieplot.setCircular(true); pieplot.setLabelGap(0.02D); LegendTitle legendtitle = new LegendTitle(jfreechart.getPlot()); BlockContainer blockcontainer = new BlockContainer(new BorderArrangement()); blockcontainer.setFrame(new BlockBorder(1.0D, 1.0D, 1.0D, 1.0D)); LabelBlock labelblock = new LabelBlock("Legend Items:", new Font("SansSerif", 1, 12)); labelblock.setPadding(5D, 5D, 5D, 5D); blockcontainer.add(labelblock, RectangleEdge.TOP); LabelBlock labelblock1 = new LabelBlock("Source: http://www.jfree.org"); labelblock1.setPadding(8D, 20D, 2D, 5D); blockcontainer.add(labelblock1, RectangleEdge.BOTTOM); BlockContainer blockcontainer1 = legendtitle.getItemContainer(); blockcontainer1.setPadding(2D, 10D, 5D, 2D); blockcontainer.add(blockcontainer1); legendtitle.setWrapper(blockcontainer); legendtitle.setPosition(RectangleEdge.RIGHT); legendtitle.setHorizontalAlignment(HorizontalAlignment.LEFT); jfreechart.addSubtitle(legendtitle); return jfreechart; }
From source file:PieChartCreate.PieChart_AWT.java
private static JFreeChart createChart(PieDataset dataset) { JFreeChart chart = ChartFactory.createPieChart("Department Wise " + title, // chart title dataset, // data true, // include legend true, false);/*from www . j a v a 2 s . co m*/ return chart; }
From source file:Interface.Camembert.java
public static JPanel cCamembert(JFrame f, ArrayList<ArrayList> liste) { // On rcupre les 2 listes ArrayList<Integer> nb = liste.get(1); ArrayList<String> nom = liste.get(2); DefaultPieDataset pieDataset = new DefaultPieDataset(); for (int i = 0; i < nb.size(); i++) { pieDataset.setValue(nom.get(i) + " : " + nb.get(i), nb.get(i)); }// w ww.j a v a 2 s . c o m JFreeChart pieChart = ChartFactory.createPieChart("Nombre d'interventions par mdecin", pieDataset, true, true, true); ChartPanel cPanel = new ChartPanel(pieChart); return cPanel; }
From source file:org.jfree.chart.demo.JDBCPieChartDemo.java
public JDBCPieChartDemo(String s) { super(s);//from w ww . j a v a 2s .com PieDataset piedataset = readData(); JFreeChart jfreechart = ChartFactory.createPieChart("JDBC Pie Chart Demo", piedataset, true, true, false); jfreechart.setBackgroundPaint(Color.yellow); PiePlot pieplot = (PiePlot) jfreechart.getPlot(); pieplot.setNoDataMessage("No data available"); ChartPanel chartpanel = new ChartPanel(jfreechart); setContentPane(chartpanel); }
From source file:view.PieChartDemo1.java
/** * Creates a chart./*from w ww . j a v a 2 s.c o m*/ * * @param dataset the dataset. * * @return A chart. */ private static JFreeChart createChart(PieDataset dataset) { JFreeChart chart = ChartFactory.createPieChart("Statics", // chart title dataset, // data true, // include legend true, false); PiePlot plot = (PiePlot) chart.getPlot(); plot.setSectionOutlinesVisible(false); plot.setNoDataMessage("No data available"); return chart; }
From source file:utils.Graphs.java
public static File generate(File baseFolder, String titles[], int[] values, Color backgroundColor) { DefaultPieDataset dataset = new DefaultPieDataset(); // add our data values int i = -1;/*from w w w.j a va 2 s. co m*/ for (String title : titles) { i++; dataset.setValue(title, values[i]); } final JFreeChart chart = // ChartFactory.createPieChart("", dataset, true, true, false); ChartFactory.createPieChart("", // chart title dataset, // data true, // include legend true, false); PiePlot plot = (PiePlot) chart.getPlot(); //PiePlot3D plot = (PiePlot3D) chart.getPlot(); //plot.setStartAngle(290); plot.setStartAngle(45); plot.setDirection(Rotation.CLOCKWISE); plot.setForegroundAlpha(0.5f); // final PiePlot plot = (PiePlot) chart.getPlot(); plot.setBackgroundPaint(backgroundColor); // plot.setLegendLabelGenerator( // new StandardPieSectionLabelGenerator("{0} {2}")); chart.setBorderVisible(false); chart.getPlot().setOutlineVisible(false); chart.getLegend().setFrame(BlockBorder.NONE); // get the same background chart.setBackgroundPaint(backgroundColor); chart.getLegend().setBackgroundPaint(backgroundColor); // hide the shadow effects plot.setShadowXOffset(0); plot.setShadowYOffset(0); //chart.getLegend().setVisible(false); plot.setCircular(true); //plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0} {2}", NumberFormat.getNumberInstance(), NumberFormat plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{2}", NumberFormat.getNumberInstance(), NumberFormat.getPercentInstance())); plot.setNoDataMessage("No data found."); Color greenColor = new Color(0x8FBC0C); Color redColor = new Color(0xFF0000); //Color redColor = new Color(0xDA6022); plot.setSectionPaint(0, greenColor); plot.setSectionPaint(1, redColor); plot.setSectionOutlinesVisible(true); final ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection()); final File file = new File(baseFolder, "chart.png"); try { ChartUtilities.saveChartAsPNG(file, chart, 200, 160, info); } catch (IOException ex) { Logger.getLogger(Graphs.class.getName()).log(Level.SEVERE, null, ex); } // //// final ChartPanel chartPanel = new ChartPanel(chart, true); // final ChartPanel chartPanel = new ChartPanel(chart, true); // chartPanel.setMinimumDrawWidth(0); // chartPanel.setMaximumDrawWidth(Integer.MAX_VALUE); // chartPanel.setMinimumDrawHeight(0); // chartPanel.setMaximumDrawHeight(Integer.MAX_VALUE); // JDialog dialog = new JDialog(); // dialog.add(chartPanel); // dialog.setLayout(new GridLayout(1, 1)); // dialog.setSize(400, 200); // dialog.setVisible(true); return file; }
From source file:userInterface.MonitoringTeamRole.EnvironmentJPanel.java
/** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor.//from w ww . j av a 2 s . c om */ @SuppressWarnings("unchecked") private static JFreeChart createChart(PieDataset dataset) { JFreeChart chart = ChartFactory.createPieChart("Ticket statistics by severity", // chart title dataset, // data true, // include legend true, false); return chart; }
From source file:DAO.graphics.StatGRH.java
private static JFreeChart createChart(PieDataset dataset) { JFreeChart chart = ChartFactory.createPieChart("Ressouces humaines", // chart title dataset, // data true, // include legend true, false);//from w ww . j a va 2 s .c o m return chart; }