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:com.jtk.pengelolaanujian.view.dashboard.PiePanelNilai.java
private ChartPanel createChart(PieDataset data) { piechart = ChartFactory.createPieChart("Nilai Upload", data, true, true, false); PiePlot plot = (PiePlot) piechart.getPlot(); plot.setSectionPaint("Belum Di Print", new Color(60, 70, 5)); plot.setSectionPaint("Sudah Di Print", new Color(100, 20, 30)); plot.setNoDataMessage("Data Tidak Ada"); plot.setExplodePercent("data", 0.1D); plot.setLabelBackgroundPaint(new Color(255, 228, 225)); plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0} ({1})")); plot.setLegendLabelGenerator(new StandardPieSectionLabelGenerator()); // Key = 0 ----> section as String (Windows, Linux, Lainnya) // Key = 1 ----> section as value (300,200,100) // KEy - 2 ----> section as percentage (50%,33%,17 %) Muncul jika aplikasi telah di running plot.setSimpleLabels(true);/*from w ww.j a va 2 s.c o m*/ plot.setInteriorGap(0.0D); return new ChartPanel(piechart); }
From source file:com.js.quickestquail.ui.stats.GenreStat.java
private JFreeChart generateChart() { JFreeChart chart = ChartFactory.createPieChart( java.util.ResourceBundle.getBundle("i18n/i18n").getString("stat.genre.title"), // chart title generateDataset(), // data true, // include legend true, false);//from w w w .ja v a2 s. c o m chart.setBackgroundPaint(new Color(0xFF, 0xFF, 0xFF, 0)); chart.getPlot().setBackgroundPaint(Color.WHITE); return chart; }
From source file:view.GerarGrafico.java
private JFreeChart createChart(PieDataset dataset) { JFreeChart chart = ChartFactory.createPieChart("Grfico de Transaes", // chart title dataset, // data true, // include legend true, false//from w w w. j a v a 2 s . c o m ); PiePlot plot = (PiePlot) chart.getPlot(); plot.setSectionPaint("Provento", new Color(68, 157, 68)); plot.setSectionPaint("Despesa", new Color(217, 83, 79)); plot.setLabelFont(new Font("Segoue UI", Font.PLAIN, 12)); plot.setNoDataMessage("No data available"); plot.setCircular(false); plot.setLabelGap(0.02); return chart; }
From source file:com.js.quickestquail.ui.stats.LanguageStat.java
private JFreeChart generateChart() { JFreeChart chart = ChartFactory.createPieChart( java.util.ResourceBundle.getBundle("i18n/i18n").getString("stat.language.title"), // chart title generateDataset(), // data true, // include legend true, false);// ww w. ja v a 2s . co m chart.setBackgroundPaint(new Color(0xFF, 0xFF, 0xFF, 0)); chart.getPlot().setBackgroundPaint(Color.WHITE); return chart; }
From source file:org.primefaces.showcase.view.multimedia.GraphicImageView.java
@PostConstruct public void init() { try {/*w w w .j a v a 2 s .co m*/ //Graphic Text BufferedImage bufferedImg = new BufferedImage(100, 25, BufferedImage.TYPE_INT_RGB); Graphics2D g2 = bufferedImg.createGraphics(); g2.drawString("This is a text", 0, 10); ByteArrayOutputStream os = new ByteArrayOutputStream(); ImageIO.write(bufferedImg, "png", os); graphicText = new DefaultStreamedContent(new ByteArrayInputStream(os.toByteArray()), "image/png"); //Chart JFreeChart jfreechart = ChartFactory.createPieChart("Cities", createDataset(), true, true, false); File chartFile = new File("dynamichart"); ChartUtilities.saveChartAsPNG(chartFile, jfreechart, 375, 300); chart = new DefaultStreamedContent(new FileInputStream(chartFile), "image/png"); } catch (Exception e) { e.printStackTrace(); } }
From source file:com.js.quickestquail.ui.stats.CountryStat.java
private JFreeChart generateChart() { JFreeChart chart = ChartFactory.createPieChart( java.util.ResourceBundle.getBundle("i18n/i18n").getString("stat.country.title"), // chart title generateDataset(), // data true, // include legend true, false);/* w w w.j a v a 2s . c o m*/ chart.setBackgroundPaint(new Color(0xFF, 0xFF, 0xFF, 0)); chart.getPlot().setBackgroundPaint(Color.WHITE); return chart; }
From source file:picocash.components.panel.statistic.AbstractPieStatisticComponent.java
private final void init() { this.title = getTitle(); this.dataset = new DefaultPieDataset(); this.chartPanel = new JXPanel(new MigLayout("fill, insets 0 0 0 0")); final JFreeChart piechart = ChartFactory.createPieChart(title, dataset, true, true, Locale.getDefault()); ((PiePlot) piechart.getPlot()).setLabelGenerator(null); piechart.setBorderVisible(false);/* w w w.jav a 2s . co m*/ piechart.setAntiAlias(true); ChartPanel chart = new ChartPanel(piechart, 300, 300, 200, 200, 400, 400, false, false, false, false, false, true); chart.getChart().getPlot().setBackgroundAlpha(0); chart.getChart().getPlot().setOutlineVisible(false); this.chartPanel.setOpaque(false); this.chartPanel.add(chart, "growx, aligny top"); }
From source file:com.ouc.cpss.view.SupTradeChartBuilder.java
private static JFreeChart createJFreeChart(PieDataset dataset) { /**/*from ww w . j av a2 s . c om*/ * JFreeChart */ //? StandardChartTheme standardChartTheme = new StandardChartTheme("CN"); // standardChartTheme.setExtraLargeFont(new Font("", Font.BOLD, 20)); // standardChartTheme.setRegularFont(new Font("", Font.PLAIN, 15)); //? standardChartTheme.setLargeFont(new Font("", Font.PLAIN, 15)); //? ChartFactory.setChartTheme(standardChartTheme); //?? //createPieChart 2D; createPieChart3D 3D JFreeChart chart = ChartFactory.createPieChart("", dataset, true, true, false); //,? chart.setTitle(new TextTitle("", new Font("", Font.ITALIC, 22))); //? LegendTitle legend = chart.getLegend(0); //,ture,? legend.setItemFont(new Font("", Font.BOLD, 20)); //?(??) PiePlot plot = (PiePlot) chart.getPlot(); //?==? plot.setLabelFont(new Font("", Font.BOLD, 22)); // plot.setBaseSectionOutlinePaint(Color.BLUE); // plot.setBaseSectionOutlineStroke(new BasicStroke(0.5f)); //?,??,?? plot.setDirection(Rotation.CLOCKWISE);//,Rotation.CLOCKWISE //() plot.setStartAngle(70); //??? //plot.setExplodePercent(1, 0.5D); //plot.setExplodePercent("One", 0.5D); //,3D? plot.setExplodePercent(dataset.getKey(0), 0.1d); // plot.setLabelLinkPaint(Color.BLUE); // plot.setLabelOutlinePaint(Color.black); // plot.setLabelShadowPaint(Color.RED); // plot.setSectionPaint(1, Color.BLACK); // :,{0},{1},{2}?,??? plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0}:{1}\r\n{2}", NumberFormat.getNumberInstance(), new DecimalFormat("0.00%"))); // plot.setLegendLabelGenerator(new StandardPieSectionLabelGenerator("{0}={2}")); //:(true),(false) plot.setCircular(true); //? plot.setNoDataMessage("??..."); //??? plot.setToolTipGenerator(new StandardPieToolTipGenerator()); // //plot.setURLGenerator(new StandardPieURLGenerator("detail.jsp")); return chart; }
From source file:com.jtk.pengelolaanujian.view.dashboard.PiePanelSoal.java
private ChartPanel createChart(PieDataset data) { piechart = ChartFactory.createPieChart("Soal Upload", data, true, true, false); PiePlot plot = (PiePlot) piechart.getPlot(); plot.setSectionPaint("Belum Di Print", new Color(135, 206, 250)); plot.setSectionPaint("Sudah Di Print", new Color(205, 133, 63)); plot.setNoDataMessage("Data Tidak Ada"); plot.setExplodePercent("data", 0.1D); plot.setLabelBackgroundPaint(new Color(255, 228, 225)); plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0} ({1})")); plot.setLegendLabelGenerator(new StandardPieSectionLabelGenerator()); // Key = 0 ----> section as String (Windows, Linux, Lainnya) // Key = 1 ----> section as value (300,200,100) // KEy - 2 ----> section as percentage (50%,33%,17 %) Muncul jika aplikasi telah di running plot.setSimpleLabels(true);// w w w.ja v a 2s .c o m plot.setInteriorGap(0.0D); return new ChartPanel(piechart); }
From source file:com.tencent.wstt.apt.chart.PieChart.java
private JFreeChart createChart() { this.dataset = new DefaultPieDataset(); final JFreeChart chart = ChartFactory.createPieChart("??", this.dataset, true, true, false); chart.getTitle().setFont(new Font("", Font.BOLD, 20)); PiePlot plot = (PiePlot) chart.getPlot(); plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0}:{1}")); plot.setLabelFont(new Font("SansSerif", Font.PLAIN, 12)); plot.setNoDataMessage("No data available"); plot.setCircular(false);/*from www . j a v a2 s .c om*/ plot.setLabelGap(0.02); return chart; }