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:edu.isistan.carcha.plugin.editors.TraceabilityEditor.java
/** * Creates the impact Pie Chart page. It allows users to select a Crosscutting Concern and see Design Decision type distribution */// ww w . ja v a 2 s .c o m void impactPieChartPage() { ddDataset = new DefaultPieDataset(); impactDataset = new DefaultPieDataset(); JFreeChart ddChart = ChartFactory.createPieChart("Crosscutting Concerns", ddDataset, true, true, false); JFreeChart impactChart = ChartFactory.createPieChart("Design Decisions", impactDataset, true, true, false); PiePlot ddPlot = (PiePlot) ddChart.getPlot(); ddPlot.setStartAngle(290); ddPlot.setDirection(Rotation.CLOCKWISE); ddPlot.setForegroundAlpha(0.5f); PiePlot impactPlot = (PiePlot) impactChart.getPlot(); impactPlot.setStartAngle(290); impactPlot.setDirection(Rotation.CLOCKWISE); impactPlot.setForegroundAlpha(0.5f); PieSectionLabelGenerator gen = new StandardPieSectionLabelGenerator("{0} ({2})"); ddPlot.setLabelGenerator(gen); impactPlot.setLabelGenerator(gen); Composite composite = new Composite(getContainer(), SWT.NONE); FillLayout layout = new FillLayout(); composite.setLayout(layout); final ChartComposite cComposite = new ChartComposite(composite, SWT.NONE, ddChart, true); cComposite.addChartMouseListener(new ChartMouseListener() { @Override public void chartMouseClicked(ChartMouseEvent event) { String[] parts = event.getEntity().getToolTipText().split(":"); HashMap<String, Integer> values = PluginUtil.getDDDistributionForCrossCuttingConcern(cp, parts[0]); logger.info("Impact Pie Chart for: " + parts[0]); impactDataset.clear(); for (String key : values.keySet()) { impactDataset.setValue(key, values.get(key)); } } @Override public void chartMouseMoved(ChartMouseEvent event) { } }); new ChartComposite(composite, SWT.NONE, impactChart, true); int index = addPage(composite); setPageText(index, "Graph"); }
From source file:lucee.runtime.tag.Chart.java
private void chartPie() throws PageException, IOException { // do dataset DefaultPieDataset dataset = new DefaultPieDataset(); ChartSeriesBean csb = _series.get(0); ChartDataBean cdb;//from w w w.ja v a2 s . c o m List datas = csb.getDatas(); if (sortxaxis) Collections.sort(datas); Iterator itt = datas.iterator(); while (itt.hasNext()) { cdb = (ChartDataBean) itt.next(); dataset.setValue(cdb.getItemAsString(), cdb.getValue()); } JFreeChart chart = show3d ? ChartFactory.createPieChart3D(title, dataset, false, true, true) : ChartFactory.createPieChart(title, dataset, false, true, true); Plot p = chart.getPlot(); PiePlot pp = (PiePlot) p; Font _font = getFont(); pp.setLegendLabelGenerator(new PieSectionLegendLabelGeneratorImpl(_font, chartwidth)); pp.setBaseSectionOutlinePaint(Color.GRAY); // border pp.setLegendItemShape(new Rectangle(7, 7)); pp.setLabelFont(new Font(font, 0, 11)); pp.setLabelLinkPaint(COLOR_333333); pp.setLabelLinkMargin(-0.05); pp.setInteriorGap(0.123); pp.setLabelGenerator(new PieSectionLabelGeneratorImpl(labelFormat)); databackgroundcolor = backgroundcolor; setBackground(chart, p); setBorder(chart, p); setLegend(chart, p, _font); set3d(p); setFont(chart, _font); setTooltip(chart); setScale(chart); // Slice Type and colors boolean doSclice = pieslicestyle == PIE_SLICE_STYLE_SLICED; Color[] colors = csb.getColorlist(); Iterator it = csb.getDatas().iterator(); int count = 0; while (it.hasNext()) { cdb = (ChartDataBean) it.next(); if (doSclice) pp.setExplodePercent(cdb.getItemAsString(), 0.13); if (count < colors.length) { pp.setSectionPaint(cdb.getItemAsString(), colors[count]); } count++; } writeOut(chart); }
From source file:megacasting.view.StatistiqueForm.java
private void graphOpen(DefaultPieDataset pieDataSet, String titre) { graphJFrame = new JFrame(); graphJFrame.setTitle("Graphique"); final JFreeChart pieChart = ChartFactory.createPieChart(titre, pieDataSet, true, true, false); final ChartPanel cPanel = new ChartPanel(pieChart); graphJFrame.add(cPanel);//from www.ja va 2 s .c o m graphJFrame.pack(); graphJFrame.setVisible(true); }
From source file:org.sipfoundry.sipxconfig.site.cdr.CdrReports.java
private static Image createTerminationCallsPieImage(List<CdrGraphBean> beans) { // Create a dataset DefaultPieDataset data = new DefaultPieDataset(); // Fill dataset with beans data for (CdrGraphBean terminationCall : beans) { data.setValue(terminationCall.getKey(), terminationCall.getCount()); }/* w ww . java2 s . c o m*/ // Create a chart with the dataset JFreeChart chart = ChartFactory.createPieChart(EMPTY_TITLE, data, true, true, true); chart.setBackgroundPaint(Color.lightGray); chart.getTitle().setPaint(Color.BLACK); PiePlot chartplot = (PiePlot) chart.getPlot(); chartplot.setCircular(true); chartplot.setLabelGenerator(new StandardPieSectionLabelGenerator(PIECHART_SECTIONLABEL_FORMAT)); // Create and return the image return chart.createBufferedImage(500, 220, BufferedImage.TYPE_INT_RGB, null); }
From source file:de.tor.tribes.ui.panels.MinimapPanel.java
private void renderChartInfo() { HashMap<Object, Marker> marks = new HashMap<>(); DefaultPieDataset dataset = buildDataset(marks); JFreeChart chart = ChartFactory.createPieChart(null, // chart title dataset, // data true, // include legend true, false);/* w w w . j a v a 2 s. c o m*/ chart.setBackgroundPaint(null); //chart.setBorderStroke(null); chart.setBorderVisible(false); final PiePlot plot = (PiePlot) chart.getPlot(); // plot.setBackgroundPaint(null); // plot.setShadowPaint(null); for (Object o : marks.keySet()) { if (iCurrentView == ID_ALLY_CHART) { Ally a = (Ally) o; plot.setSectionPaint(a.getTag(), marks.get(a).getMarkerColor()); } else { Tribe t = (Tribe) o; plot.setSectionPaint(t.getName(), marks.get(t).getMarkerColor()); } } //plot.setCircular(true); // plot.setMaximumLabelWidth(30.0); /* * plot.setLabelGenerator(new StandardPieSectionLabelGenerator( "{0} = {2}", NumberFormat.getNumberInstance(), * NumberFormat.getPercentInstance())); */ // chart.getLegend().setVerticalAlignment(VerticalAlignment.CENTER); // chart.getLegend().setPosition(RectangleEdge.RIGHT); // plot.setMaximumLabelWidth(20.0); plot.setLabelGenerator(null); plot.setBackgroundPaint(Constants.DS_BACK); /* * plot.setInteriorGap(0.0); plot.setLabelGap(0.0); */ plot.setLegendLabelGenerator(new StandardPieSectionLabelGenerator("{0} = {2}", NumberFormat.getNumberInstance(), NumberFormat.getPercentInstance())); /* * plot.getL plot.setLabelFont(g2d.getFont().deriveFont(10.0f)); */ //plot.setLabelGenerator(null); //plot.setMaximumLabelWidth(30.0); //plot.getLabelDistributor().distributeLabels(10.0, 20.0); //chart.draw(g2d, new Rectangle2D.Float(20, 20, 100, 100)); // g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha)); plot.setOutlineVisible(false); mChartImage = chart.createBufferedImage(getWidth(), getHeight()); //chart.draw(g2d, new Rectangle2D.Float(50, 50, 400, 400)); //g2d.drawImage(bi, 30, 30, null); // g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha)); //bi = chart.createBufferedImage(240, 240); // g2d.drawImage(bi, 30, 30, null); }
From source file:org.sakaiproject.sitestats.impl.chart.ChartServiceImpl.java
private byte[] generatePieChart(String siteId, PieDataset dataset, int width, int height, boolean render3d, float transparency, boolean smallFontInDomainAxis) { JFreeChart chart = null;// w w w . ja v a 2 s . c o m if (render3d) chart = ChartFactory.createPieChart3D(null, dataset, false, false, false); else chart = ChartFactory.createPieChart(null, dataset, false, false, false); PiePlot plot = (PiePlot) chart.getPlot(); // set start angle (135 or 150 deg so minor data has more space on the left) plot.setStartAngle(150D); // set transparency plot.setForegroundAlpha(transparency); // set background chart.setBackgroundPaint(parseColor(M_sm.getChartBackgroundColor())); plot.setBackgroundPaint(parseColor(M_sm.getChartBackgroundColor())); // fix border offset chart.setPadding(new RectangleInsets(5, 5, 5, 5)); plot.setInsets(new RectangleInsets(1, 1, 1, 1)); // set chart border plot.setOutlinePaint(null); chart.setBorderVisible(true); chart.setBorderPaint(parseColor("#cccccc")); // set antialias chart.setAntiAlias(true); BufferedImage img = chart.createBufferedImage(width, height); final ByteArrayOutputStream out = new ByteArrayOutputStream(); try { ImageIO.write(img, "png", out); } catch (IOException e) { LOG.warn("Error occurred while generating SiteStats chart image data", e); } return out.toByteArray(); }
From source file:ca.myewb.frame.servlet.GraphServlet.java
private JFreeChart getProvincePie(Session s) { JFreeChart chart;/* www. ja va 2 s . c o m*/ String[] provinces = { "PE", "YT", "NT", "NU", "ON", "QC", "AB", "BC", "NL", "MB", "NB", "NS", "SK" }; DefaultPieDataset ds = new DefaultPieDataset(); String query = "select count(*) from UserModel as u where u.province=?"; int total = 0; for (String province : provinces) { Integer integer = ((Long) s.createQuery(query).setString(0, province).list().get(0)).intValue(); total += integer; ds.setValue(province, integer); } chart = ChartFactory.createPieChart("Province Breakdown (for " + total + " known addresses)", ds, false, false, false); PiePlot plot = ((PiePlot) chart.getPlot()); StandardPieItemLabelGenerator n = new StandardPieItemLabelGenerator("{0} = {1} ({2})", new DecimalFormat("0"), new DecimalFormat("0.0%")); plot.setLabelGenerator(n); return chart; }
From source file:GUI.Framedashboard.java
public void stat() { Statestique st = new Statestique(); int u = st.nbUser(); int f = st.nbfemme(); int h = u - f; int p = st.nbProduit(); int s = st.nbService(); int c = st.nbComment(); int pp = st.nbPauP(); DefaultCategoryDataset dataset = new DefaultCategoryDataset(); dataset.setValue(s, "", "Service"); dataset.setValue(p, "", "Produit"); JFreeChart chart = ChartFactory.createBarChart("Service et Produit", null, null, dataset, PlotOrientation.VERTICAL, false, false, false); CategoryPlot cp = chart.getCategoryPlot(); // cp.setRangeGridlinePaint(Color.BLACK); ChartPanel chp = new ChartPanel(chart); jPanel5.removeAll();//from ww w . j a va 2 s . com jPanel5.add(chp); jPanel5.validate(); DefaultCategoryDataset ds = new DefaultCategoryDataset(); ds.setValue(pp, "", "Commande"); ds.setValue(c, "", "Commentaire"); JFreeChart cht = ChartFactory.createBarChart("Graphe de Commentaire & Commande", null, null, ds, PlotOrientation.VERTICAL, false, false, false); CategoryPlot catp = chart.getCategoryPlot(); // catp.setRangeGridlinePaint(Color.BLACK); ChartPanel chartp = new ChartPanel(cht); jPanel6.removeAll(); jPanel6.add(chartp); jPanel6.validate(); DefaultPieDataset pds = new DefaultPieDataset(); pds.setValue("Femme", new Integer(f)); pds.setValue("Homme", new Integer(h)); JFreeChart chartpie = ChartFactory.createPieChart("Genre", pds, true, true, false); PiePlot plot = (PiePlot) chartpie.getPlot(); ChartPanel chartpiepanel = new ChartPanel(chartpie); jPanel7.removeAll(); jPanel7.add(chartpiepanel); jPanel7.validate(); }
From source file:projekt.CustomRenderer.java
public void raport_globalny() throws IOException, ClassNotFoundException, SQLException { String zapytanie = "select count(*) as Aktualne from zadania where Status_zadania='Aktualne'"; String zapytanie1 = "select count(*) as FORTEST from zadania where Status_zadania='FORTEST'"; String zapytanie2 = "select count(*) as Zakonczone from zadania where Status_zadania='Zakonczone'"; Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/pz?characterEncoding=utf8", "root", ""); PreparedStatement statment;//from ww w. j a v a 2s . c o m ResultSet result; double odp = 0, odp1 = 0, odp2 = 0; statment = con.prepareStatement(zapytanie); result = statment.executeQuery(); if (result.next()) { odp = result.getDouble("Aktualne"); } statment = con.prepareStatement(zapytanie1); result = statment.executeQuery(); if (result.next()) { odp1 = result.getDouble("FORTEST"); } statment = con.prepareStatement(zapytanie2); result = statment.executeQuery(); if (result.next()) { odp2 = result.getDouble("Zakonczone"); } loginController login = new loginController(); statment = con.prepareStatement( "SELECT CONCAT(imie, ' ', nazwisko) as osoba from uzytkownicy WHERE idUzytkownika = '" + login.uzytkownikID + "'"); result = statment.executeQuery(); String bbc = ""; if (result.next()) { bbc = result.getString(1); } DefaultCategoryDataset set2 = new DefaultCategoryDataset(); set2.setValue(odp, "", "Aktualne"); set2.setValue(odp1, "", "FORTEST"); set2.setValue(odp2, "", "Zakonczone"); JFreeChart chart = ChartFactory.createBarChart("Wszystkie zadania w bazie", "Zadania", "Ilosc", set2, PlotOrientation.VERTICAL, false, true, false); final CategoryItemRenderer renderer = new CustomRenderer(new Paint[] { Color.red, Color.blue, Color.green, Color.yellow, Color.orange, Color.cyan, Color.magenta, Color.blue }); final CategoryPlot plot = chart.getCategoryPlot(); plot.setNoDataMessage("NO DATA!"); renderer.setItemLabelsVisible(true); final ItemLabelPosition p = new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER, TextAnchor.CENTER, 45.0); renderer.setPositiveItemLabelPosition(p); plot.setRenderer(renderer); ByteArrayOutputStream out = new ByteArrayOutputStream(); ChartUtilities.writeChartAsJPEG(out, chart, 450, 600); DateFormat dataformat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); DateFormat dataformat1 = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss"); Date data = new Date(); String fileName = "Raport globalny " + dataformat1.format(data) + ".pdf"; try { PDRectangle PAGE_SIZE = PDRectangle.A4; PDDocument doc = new PDDocument(); PDFont font = PDType0Font.load(doc, getClass().getResourceAsStream("/fonts/RobotoCondensed-Regular.ttf")); PDFont font1 = PDType0Font.load(doc, getClass().getResourceAsStream("/fonts/RobotoCondensed-Bold.ttf")); PDPage page = new PDPage(PAGE_SIZE); PDPage page1 = new PDPage(PAGE_SIZE); doc.addPage(page); PDPageContentStream content = new PDPageContentStream(doc, page); //naglowek strona 1 Naglowek(content, dataformat, data); //stopka strona1 Stopka(content, doc); content.beginText(); content.setFont(font1, 48); content.moveTextPositionByAmount(135, 550); content.showText("Raport globalny"); content.endText(); content.beginText(); content.setFont(font, 22); content.moveTextPositionByAmount(30, 250); content.showText("Wersja systemu : 1.0"); content.newLine(); content.moveTextPositionByAmount(0, 35); content.showText("Autor raportu : " + result.getString("osoba")); content.endText(); content.close(); PDPageContentStream content1 = new PDPageContentStream(doc, page1); PDPage page2 = new PDPage(PAGE_SIZE); doc.addPage(page2); PDPageContentStream content2 = new PDPageContentStream(doc, page2); Naglowek(content2, dataformat, data); //stopka strona2 Stopka(content2, doc); content2.beginText(); content2.setFont(font, 14); content2.moveTextPositionByAmount(30, 775); content2.showText("Wszystkie projekty z bazy danych:"); statment = con.prepareStatement("Select Nazwa, Opis, Poczatek, Koniec, ludzie from projekty"); result = statment.executeQuery(); content2.newLine(); int liczba = 615; content2.moveTextPositionByAmount(0, -15); while (result.next()) { content2.newLine(); content2.moveTextPositionByAmount(0, -22); liczba += 22; //content2.showText("Nazwa : "+result.getString("Nazwa")+" Opis: "+result.getString("Opis")+" Data rozpoczecia: "+result.getString("Poczatek")+" Data zakonczenia: "+result.getString("Koniec")); content2.showText("Nazwa : " + result.getString("Nazwa") + " Opis: " + result.getString("Opis")); content2.newLine(); content2.moveTextPositionByAmount(0, -17); liczba += 22; content2.showText("Data rozpoczecia: " + result.getString("Poczatek") + " Data zakonczenia: " + result.getString("Koniec")); } content2.endText(); // content2.setLineWidth(2); // content2.moveTo(10, liczba + 5); // content2.lineTo(10, liczba +5); // content2.closeAndStroke(); DateFormat dataformat2 = new SimpleDateFormat("yyyy-MM-dd"); statment = con.prepareStatement("Select count(*) as 'Aktualne' from projekty where Koniec > '" + dataformat2.format(data) + "'"); result = statment.executeQuery(); int aktualne = 0, zakonczone = 0; if (result.next()) { aktualne = result.getInt("Aktualne"); } System.out.println("aktualne:" + aktualne); statment = con.prepareStatement("Select count(*) as 'Zakonczone' from projekty where Koniec < '" + dataformat2.format(data) + "'"); result = statment.executeQuery(); if (result.next()) { zakonczone = result.getInt("Zakonczone"); } System.out.println("zakonczone:" + zakonczone); DefaultPieDataset pieDataset = new DefaultPieDataset(); pieDataset.setValue("Aktualne", aktualne); pieDataset.setValue("Zakonczone", zakonczone); JFreeChart chart1 = ChartFactory.createPieChart("Zestawienia projektw", // Title pieDataset, // Dataset true, // Show legend true, // Use tooltips false // Configure chart to generate URLs? ); PiePlot plot1 = (PiePlot) chart1.getPlot(); plot1.setSectionPaint("Aktualne", Color.green); plot1.setSectionPaint("Zakonczone", Color.red); plot1.setExplodePercent("Aktualne", 0.10); plot1.setSimpleLabels(true); PieSectionLabelGenerator gen = new StandardPieSectionLabelGenerator("{0}: {1} ({2})", new DecimalFormat("0"), new DecimalFormat("0%")); plot1.setLabelGenerator(gen); ByteArrayOutputStream out1 = new ByteArrayOutputStream(); ChartUtilities.writeChartAsJPEG(out1, chart1, 450, 600); PDImageXObject img1 = JPEGFactory.createFromStream(doc, new ByteArrayInputStream(out1.toByteArray())); content2.close(); PDPage page3 = new PDPage(PAGE_SIZE); doc.addPage(page3); PDPageContentStream content3 = new PDPageContentStream(doc, page3); Naglowek(content3, dataformat, data); //stopka strona2 Stopka(content3, doc); content3.drawImage(img1, 50, 50); content3.close(); PDPage page4 = new PDPage(PAGE_SIZE); doc.addPage(page4); PDPageContentStream content4 = new PDPageContentStream(doc, page4); Naglowek(content4, dataformat, data); //stopka strona2 Stopka(content4, doc); content4.beginText(); content4.setFont(font, 14); content4.moveTextPositionByAmount(30, 780); content4.showText("Wszystkie zadania w bazie:"); statment = con.prepareStatement( "SELECT `Nazwa`,`Opis`,`Status_zadania`,`projekt`, CONCAT(x.imie, \" \", x.nazwisko) as \"UZY\" FROM `zadania` , (SELECT imie, nazwisko, idUzytkownika from uzytkownicy) X WHERE zadania.idUzytkownika=x.idUzytkownika limit 12"); result = statment.executeQuery(); content4.newLine(); int nw = 850; content4.moveTextPositionByAmount(0, -15); nw -= 15; while (result.next()) { content4.newLine(); nw -= 22; content4.moveTextPositionByAmount(0, -22); //content2.showText("Nazwa : "+result.getString("Nazwa")+" Opis: "+result.getString("Opis")+" Data rozpoczecia: "+result.getString("Poczatek")+" Data zakonczenia: "+result.getString("Koniec")); content4.showText("Nazwa : " + result.getString("Nazwa")); content4.newLine(); nw -= 17; content4.moveTextPositionByAmount(0, -17); content4.showText(" Opis: " + result.getString("Opis") + " Status zadania: " + result.getString("Status_zadania")); content4.newLine(); nw -= 17; content4.moveTextPositionByAmount(0, -17); content4.showText(" Projekt: " + result.getString("projekt") + " Przydzielona osoba do zadania: " + result.getString("UZY")); } content4.endText(); content4.close(); statment = con.prepareStatement("SELECT count(*) as 'liczba' FROM `zadania`"); result = statment.executeQuery(); if (result.next()) { } statment = con.prepareStatement( "SELECT `Nazwa`,`Opis`,`Status_zadania`,`projekt`, CONCAT(x.imie, \" \", x.nazwisko) as \"UZY\" FROM `zadania` , (SELECT imie, nazwisko, idUzytkownika from uzytkownicy) X WHERE zadania.idUzytkownika=x.idUzytkownika limit 12," + result.getInt(1) + ""); result = statment.executeQuery(); PDPage page5 = new PDPage(PAGE_SIZE); doc.addPage(page5); PDPageContentStream content5 = new PDPageContentStream(doc, page5); Naglowek(content5, dataformat, data); //stopka strona2 Stopka(content5, doc); content5.beginText(); content5.setFont(font, 14); content5.moveTextPositionByAmount(30, 700); while (result.next()) { content5.newLine(); nw -= 22; content5.moveTextPositionByAmount(0, -22); //content2.showText("Nazwa : "+result.getString("Nazwa")+" Opis: "+result.getString("Opis")+" Data rozpoczecia: "+result.getString("Poczatek")+" Data zakonczenia: "+result.getString("Koniec")); content5.showText("Nazwa : " + result.getString("Nazwa")); content5.newLine(); nw -= 17; content5.moveTextPositionByAmount(0, -17); content5.showText(" Opis: " + result.getString("Opis") + " Status zadania: " + result.getString("Status_zadania")); content5.newLine(); nw -= 17; content5.moveTextPositionByAmount(0, -17); content5.showText(" Projekt: " + result.getString("projekt") + " Przydzielona osoba do zadania: " + result.getString("UZY")); } content5.endText(); content5.close(); doc.addPage(page1); //naglowek strona 2 Naglowek(content1, dataformat, data); //stopka strona2 Stopka(content1, doc); PDImageXObject img = JPEGFactory.createFromStream(doc, new ByteArrayInputStream(out.toByteArray())); content1.drawImage(img, 50, 50); content1.close(); doc.save(fileName); doc.close(); } catch (Exception e) { System.err.println(e.getMessage()); } }
From source file:org.sipfoundry.sipxconfig.site.cdr.CdrReports.java
private Image createCallDirectionCallsPieImage(List<CdrGraphBean> beans) { // Create a dataset DefaultKeyedValuesDataset data = new DefaultKeyedValuesDataset(); // Fill dataset with beans data for (CdrGraphBean directionCall : beans) { data.setValue(directionCall.getKey(), directionCall.getCount()); }//from w w w. j a v a2 s .c o m // Create a chart with the dataset JFreeChart chart = ChartFactory.createPieChart(EMPTY_TITLE, data, true, true, false); chart.setBackgroundPaint(Color.lightGray); chart.setTitle("Summary - " + getMessages().getMessage(TITLE_CALLDIRECTION_REPORT_KEY)); chart.getTitle().setPaint(Color.BLACK); PiePlot chartplot = (PiePlot) chart.getPlot(); chartplot.setCircular(true); chartplot.setLabelGenerator(new StandardPieSectionLabelGenerator(PIECHART_SECTIONLABEL_FORMAT)); // Create and return the image return chart.createBufferedImage(500, 220, BufferedImage.TYPE_INT_RGB, null); }