List of usage examples for org.jfree.chart.plot PiePlot setNoDataMessage
public void setNoDataMessage(String message)
null
, and sends a PlotChangeEvent to all registered listeners. From source file:com.jtk.pengelolaanujian.view.dashboard.PiePanelVnv.java
private ChartPanel createChart(PieDataset data) { piechart = ChartFactory.createPieChart("Soal Vnv", data, true, true, false); PiePlot plot = (PiePlot) piechart.getPlot(); plot.setSectionPaint("Belum Di VNV", new Color(135, 206, 250)); plot.setSectionPaint("sudah Di VNV", 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);/*from w w w . j a v a2 s .c o m*/ plot.setInteriorGap(0.0D); return new ChartPanel(piechart); }
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 v a2 s . c o m*/ plot.setInteriorGap(0.0D); return new ChartPanel(piechart); }
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);/*from w w w .j a va2 s .c o m*/ plot.setInteriorGap(0.0D); return new ChartPanel(piechart); }
From source file:org.jfree.chart.demo.XMLPieChartDemo.java
/** * Default constructor.//w w w . ja va 2 s . co m * * @param title the frame title. */ public XMLPieChartDemo(final String title) { super(title); // create a dataset... PieDataset dataset = null; final URL url = getClass().getResource("/org/jfree/chart/demo/piedata.xml"); try { final InputStream in = url.openStream(); dataset = DatasetReader.readPieDatasetFromXML(in); } catch (IOException ioe) { System.out.println(ioe.getMessage()); } // create the chart... final JFreeChart chart = ChartFactory.createPieChart("Pie Chart Demo 1", // chart title dataset, // data true, // include legend true, false); // set the background color for the chart... chart.setBackgroundPaint(Color.yellow); final PiePlot plot = (PiePlot) chart.getPlot(); plot.setLabelGenerator(new StandardPieItemLabelGenerator("{0} = {2}", NumberFormat.getNumberInstance(), NumberFormat.getPercentInstance())); plot.setNoDataMessage("No data available"); // add the chart to a panel... final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(500, 270)); setContentPane(chartPanel); }
From source file:nl.wur.plantbreeding.logic.jfreechart.PieChart.java
/** * Create the Pie Chart using the given dataset. * It assigns to the chart the given title, prints the legend if asked, * adds a tooltips of the given url./* w w w . j a v a 2 s . c o m*/ * @param dataset a PieDataset * @param title the title of the graph * @param boollegend wether to add the legend or not * @param tooltips wether to add the tooltips or not * @param urls wether to link the different part of the plot or not * @return a JFreeChart object of the pie chart */ public final JFreeChart createChart(final PieDataset dataset, final String title, final boolean boollegend, final boolean tooltips, final boolean urls) { JFreeChart chart = ChartFactory.createPieChart(title, // chart title dataset, // data boollegend, // include legend tooltips, // include tooltips urls // include urls ); PiePlot plot = (PiePlot) chart.getPlot(); plot.setBackgroundAlpha(new Float(0.0)); plot.setSectionOutlinesVisible(false); plot.setNoDataMessage("No data available"); plot.setOutlineVisible(false); // remove borders around the plot return chart; }
From source file:org.pentaho.chart.plugin.jfreechart.chart.pie.JFreePieChartGenerator.java
/** * Set Plot attributes for the Pie Chart * </p>//from w w w . j av a 2 s. c o m * @param piePlot The pie plot retrieved from the chart object. * @param chartDocument Chart document for the current chart definition. * @param data Actual data. */ private void setPlotAttributes(final PiePlot piePlot, final ChartDocument chartDocument, final ChartTableModel data) { piePlot.setNoDataMessage("No data available"); //$NON-NLS-1$ piePlot.setCircular(false); piePlot.setLabelGap(0.02); final ChartElement plotElement = chartDocument.getPlotElement(); setLabelPlacingInsideChart(piePlot, plotElement); setSeriesAttributes(piePlot, chartDocument, data); setStartAngle(piePlot, chartDocument.getPlotElement()); }
From source file:probe.com.view.body.quantcompare.PieChart.java
private String initPieChart(int width, int height, String title) { DefaultPieDataset dataset = new DefaultPieDataset(); for (int x = 0; x < labels.length; x++) { dataset.setValue(labels[x], values[x]); }/*from w w w . j av a2s .c om*/ PiePlot plot = new PiePlot(dataset); plot.setNoDataMessage("No data available"); plot.setCircular(true); plot.setLabelGap(0); plot.setLabelFont(new Font("Verdana", Font.BOLD, 10)); plot.setLabelGenerator(new PieSectionLabelGenerator() { @Override public String generateSectionLabel(PieDataset pd, Comparable cmprbl) { return valuesMap.get(cmprbl.toString()); } @Override public AttributedString generateAttributedSectionLabel(PieDataset pd, Comparable cmprbl) { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } }); plot.setSimpleLabels(true); plot.setLabelBackgroundPaint(null); plot.setLabelShadowPaint(null); plot.setLabelPaint(Color.WHITE); plot.setLabelOutlinePaint(null); plot.setBackgroundPaint(Color.WHITE); plot.setInteriorGap(0); plot.setShadowPaint(Color.WHITE); plot.setOutlineVisible(false); plot.setBaseSectionOutlinePaint(Color.WHITE); plot.setSectionOutlinesVisible(true); plot.setBaseSectionOutlineStroke(new BasicStroke(1.2f)); plot.setInteriorGap(0.05); for (String label : labels) { plot.setSectionPaint(label, defaultKeyColorMap.get(label)); } JFreeChart chart = new JFreeChart(plot); // chart.setTitle(new TextTitle(title, new Font("Verdana", Font.BOLD, 13))); chart.setBorderPaint(null); chart.setBackgroundPaint(null); chart.getLegend().setFrame(BlockBorder.NONE); chart.getLegend().setItemFont(new Font("Verdana", Font.PLAIN, 10)); String imgUrl = saveToFile(chart, width, height); return imgUrl; }
From source file:co.udea.edu.proyectointegrador.gr11.parqueaderoapp.domain.stadistics.graphics.implement.Grafica.java
@Override public JFreeChart createPieToUserType(List<TipoUsuarioEstadistica> tipoUsuarios) { //Se crea el conjunto de datos para el tipo de usuario PieDataset dataset = createDataForUserType(tipoUsuarios); JFreeChart pie = ChartFactory.createPieChart3D(TITLE_OF_PIE_CHART, //Titulo del grafigo dataset, //Conjunto de datos true, //Incluir leyenda true, false);//from w w w. ja v a2s. c o m PiePlot piePlot = (PiePlot) pie.getPlot(); piePlot.setStartAngle(200); piePlot.setDirection(Rotation.CLOCKWISE); piePlot.setForegroundAlpha(0.5f); piePlot.setNoDataMessage(NO_DATA_TO_DISPLAY); return pie; }
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/* 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.orange.atk.atkUI.coregui.StatisticTool.java
/** * Creates the chart./* w w w . j ava2 s .c o m*/ * * @param piedataset * the data set * @return the created chart */ private JFreeChart createChart(PieDataset piedataset) { JFreeChart jfreechart = ChartFactory.createPieChart3D("", piedataset, true, true, false); jfreechart.setBackgroundPaint(Color.lightGray); PiePlot pie3dplot = (PiePlot) jfreechart.getPlot(); pie3dplot.setStartAngle(0); pie3dplot.setDirection(Rotation.CLOCKWISE); pie3dplot.setForegroundAlpha(0.5F); pie3dplot.setNoDataMessage("No data to display"); pie3dplot.setSectionPaint(0, Color.GREEN);// passed pie3dplot.setSectionPaint(1, Color.RED);// failed pie3dplot.setSectionPaint(2, Color.ORANGE);// skipped pie3dplot.setSectionPaint(3, Color.LIGHT_GRAY);// not analysed pie3dplot.setToolTipGenerator(new MyToolTipGenerator()); pie3dplot.setLabelGenerator(new MySectionLabelGenerator()); pie3dplot.setLegendLabelGenerator(new MySectionLabelGenerator()); return jfreechart; }