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:edu.ucla.stat.SOCR.chart.demo.PieChartDemo4.java
protected JFreeChart createChart(PieDataset dataset) { // create the chart... JFreeChart chart = ChartFactory.createPieChart(chartTitle, // chart title dataset, // dataset !legendPanelOn, // include legend true, false);/*from w w w . jav a 2 s.c om*/ // set the background color for the chart... chart.setBackgroundPaint(new Color(222, 222, 255)); PiePlot plot = (PiePlot) chart.getPlot(); plot.setBackgroundPaint(Color.white); plot.setCircular(true); for (int i = 0; i < pulloutFlag.length; i++) { //System.out.println("\""+pulloutFlag[i]+"\""); if (isPullout(i)) { Comparable key = dataset.getKey(i); plot.setExplodePercent(key, 0.30); } } plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0} = {2}", NumberFormat.getNumberInstance(), NumberFormat.getPercentInstance())); plot.setNoDataMessage("No data available"); if (rotateOn) { Rotator rotator = new Rotator(plot); rotator.start(); } setCategorySummary(dataset); return chart; }
From source file:edu.ucla.stat.SOCR.applications.demo.BinomialTradingApplication.java
protected JFreeChart createEmptyChart(PieDataset dataset) { JFreeChart chart = ChartFactory.createPieChart("SOCR Chart", // chart title null, // data true, // include legend true, false);//from ww w. java 2 s . c om 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:ar.edu.uns.cs.vyglab.arq.rockar.gui.JFrameControlPanel.java
private void initCustomGUI() { // Crear un pie chart vacio pieChartDataset = new DefaultPieDataset(); chart = ChartFactory.createPieChart("Rock.AR Pie Chart", // chart title pieChartDataset, // data false, // include legend true, false);/* ww w . ja v a 2 s . c o m*/ PiePlot plot = (PiePlot) chart.getPlot(); plot.setNoDataMessage("No data available"); plot.setCircular(false); plot.setLabelGap(0.02); jPanelPieChart = new ChartPanel(this.chart); jPanelTop.add(jPanelPieChart, BorderLayout.CENTER); // TODO // hacer que los colores del pie chart se correspondan con la tabla }
From source file:it.eng.spagobi.engines.chart.bo.charttypes.piecharts.LinkablePie.java
public JFreeChart createChart(DatasetMap datasets) { Dataset dataset = (Dataset) datasets.getDatasets().get("1"); boolean document_composition = false; if (mode.equalsIgnoreCase(SpagoBIConstants.DOCUMENT_COMPOSITION)) document_composition = true;//from w w w .j a v a 2 s .c o m JFreeChart chart = null; if (!threeD) { chart = ChartFactory.createPieChart(name, (PieDataset) dataset, // data legend, // include legend true, false); chart.setBackgroundPaint(color); TextTitle title = chart.getTitle(); title.setToolTipText("A title tooltip!"); PiePlot plot = (PiePlot) chart.getPlot(); plot.setLabelFont(new Font(defaultLabelsStyle.getFontName(), Font.PLAIN, defaultLabelsStyle.getSize())); plot.setCircular(false); plot.setLabelGap(0.02); plot.setNoDataMessage("No data available"); if (percentage == false) { plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0} ({1})")); } else { plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0} ({2})")); } MyPieUrlGenerator pieUrl = new MyPieUrlGenerator(rootUrl); pieUrl.setDocument_composition(document_composition); pieUrl.setCategoryUrlLabel(categoryUrlName); pieUrl.setDrillDocTitle(drillDocTitle); pieUrl.setTarget(target); plot.setURLGenerator(pieUrl); } else { chart = ChartFactory.createPieChart3D(name, (PieDataset) dataset, // data true, // include legend true, false); chart.setBackgroundPaint(color); TextTitle title = chart.getTitle(); title.setToolTipText("A title tooltip!"); PiePlot3D plot = (PiePlot3D) chart.getPlot(); plot.setDarkerSides(true); plot.setStartAngle(290); plot.setDirection(Rotation.CLOCKWISE); plot.setForegroundAlpha(1.0f); plot.setDepthFactor(0.2); plot.setLabelFont(new Font(defaultLabelsStyle.getFontName(), Font.PLAIN, defaultLabelsStyle.getSize())); plot.setCircular(false); plot.setLabelGap(0.02); plot.setNoDataMessage("No data available"); //org.jfree.chart.renderer.category.BarRenderer renderer = new org.jfree.chart.renderer.category.AreaRenderer); MyPieUrlGenerator pieUrl = new MyPieUrlGenerator(rootUrl); pieUrl.setDocument_composition(document_composition); pieUrl.setCategoryUrlLabel(categoryUrlName); pieUrl.setDrillDocTitle(drillDocTitle); pieUrl.setTarget(target); plot.setURLGenerator(pieUrl); if (percentage == false) { plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0} ({1})")); } else { plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0} ({2})")); } } TextTitle title = setStyleTitle(name, styleTitle); chart.setTitle(title); if (subName != null && !subName.equals("")) { TextTitle subTitle = setStyleTitle(subName, styleSubTitle); chart.addSubtitle(subTitle); } return chart; }
From source file:hr.restart.util.chart.ChartXY.java
/** * Creates a PIE CHART// w w w . ja v a 2 s . c o m * @param dataset The org.jfree.data.PieDataset * @param title The title * @return org.jfree.chart.JFreeChart */ private JFreeChart createPieChart(final PieDataset dataset, String title) { final JFreeChart chart = ChartFactory.createPieChart(title, // chart title dataset, // data false, // include legend true, false); chart.setBackgroundPaint(Color.white); Plot plot = chart.getPlot(); // the subtitle from the combobox if (jcb != null) chart.addSubtitle(new TextTitle(jcb.getSelectedItem().toString())); //subtitles setted by the user. if (getSubtitles() != null) for (int i = 0; i < getSubtitles().size(); i++) { chart.addSubtitle(new TextTitle(getSubtitles().get(i).toString())); } final PiePlot piePlot = (PiePlot) plot; piePlot.setLabelFont(new Font("SansSerif", Font.PLAIN, 12)); piePlot.setNoDataMessage("NO DATA!"); piePlot.setCircular(false); piePlot.setLabelLinkPaint(Color.red); piePlot.setLabelGap(0.02); return chart; }
From source file:com.ouc.cpss.view.SupTradeChartBuilder.java
private static JFreeChart createJFreeChart(PieDataset dataset) { /**/*from w ww . j a va2 s . c o m*/ * 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:org.jivesoftware.openfire.reporting.graph.GraphEngine.java
/** * Creates a Pie Chart based on map.//from w w w .ja v a 2 s . c om * * @return the Pie Chart generated. */ public JFreeChart getPieChart(Map<String, Double> pieValues) { DefaultPieDataset dataset = new DefaultPieDataset(); for (String key : pieValues.keySet()) { dataset.setValue(key, pieValues.get(key)); } JFreeChart chart = ChartFactory.createPieChart3D(null, // chart title dataset, // data true, // include legend true, false); chart.setBackgroundPaint(Color.white); chart.setBorderVisible(false); chart.setBorderPaint(null); PiePlot plot = (PiePlot) chart.getPlot(); plot.setSectionOutlinesVisible(false); plot.setLabelFont(new Font("SansSerif", Font.BOLD, 12)); plot.setNoDataMessage("No data available"); plot.setCircular(true); plot.setLabelGap(0.02); plot.setOutlinePaint(null); plot.setLabelLinksVisible(false); plot.setLabelGenerator(null); plot.setLegendLabelGenerator(new StandardPieSectionLabelGenerator("{0}")); plot.setStartAngle(270); plot.setDirection(Rotation.ANTICLOCKWISE); plot.setForegroundAlpha(0.60f); plot.setInteriorGap(0.33); return chart; }
From source file:net.sf.eclipsecs.ui.stats.views.GraphStatsView.java
/** * Cre le graphe JFreeChart./*from ww w .j ava 2 s. c o m*/ * * @param piedataset * : la source de donnes afficher * @return le diagramme */ private JFreeChart createChart(GraphPieDataset piedataset) { JFreeChart jfreechart = ChartFactory.createPieChart3D(null, piedataset, false, true, false); jfreechart.setAntiAlias(true); jfreechart.setTextAntiAlias(true); PiePlot pieplot3d = (PiePlot) 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.setNoDataMessage(Messages.GraphStatsView_noDataToDisplay); pieplot3d.setCircular(true); 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:edu.ucla.stat.SOCR.chart.SuperPieChart.java
/** * Creates a chart.//w ww . j a va2 s . c om * * @param dataset the dataset. * * @return a chart. */ protected JFreeChart createChart(PieDataset dataset) { JFreeChart chart = ChartFactory.createPieChart(chartTitle, // chart title dataset, // data !legendPanelOn, // include legend true, false); TextTitle title = chart.getTitle(); title.setToolTipText("A title tooltip!"); PiePlot plot = (PiePlot) chart.getPlot(); if (!ThreeDPie) { for (int i = 0; i < pulloutFlag.length; i++) { //System.out.println("SuperPieChart\""+pulloutFlag[i]+"\""); if (pulloutFlag[i].equals("1")) { Comparable key = dataset.getKey(i); plot.setExplodePercent(key, 0.30); } } } 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:edu.ucla.stat.SOCR.applications.demo.PortfolioApplication2.java
protected JFreeChart createEmptyChart(String chartTitle, PieDataset dataset) { JFreeChart chart = ChartFactory.createPieChart(chartTitle, // chart title null, // data true, // include legend true, false);/*from w w w. j a va2s.com*/ 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; }