List of usage examples for org.jfree.chart.plot PiePlot3D setLabelGenerator
public void setLabelGenerator(PieSectionLabelGenerator generator)
From source file:net.nosleep.superanalyzer.analysis.views.QualityView.java
private void createChart() { _chart = ChartFactory.createPieChart3D(Misc.getString("SONG_QUALITY"), _dataset, false, true, false); PiePlot3D plot = (PiePlot3D) _chart.getPlot(); plot.setDarkerSides(true);//from w w w . ja v a2s . c om plot.setStartAngle(PieRotator.angle); plot.setDirection(Rotation.CLOCKWISE); plot.setForegroundAlpha(0.5f); plot.setNoDataMessage(Misc.getString("NO_DATA_TO_DISPLAY")); plot.setInsets(new RectangleInsets(10, 10, 10, 10)); plot.setOutlineVisible(false); plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0} ({2})")); _chart.addSubtitle(HomePanel.createSubtitle(Misc.getString("SONG_QUALITY_SUBTITLE"))); ChartUtilities.applyCurrentTheme(_chart); plot.setBackgroundPaint(Color.white); _chart.setBorderVisible(false); }
From source file:org.emftrace.quarc.ui.views.RatioView.java
/** * create a PieChart for the priorities of the goals * @param dataset the used Dataset/*from w ww. j a v a 2s.c om*/ * @return the created Chart */ private JFreeChart createChart(PieDataset dataset) { JFreeChart chart = ChartFactory.createPieChart3D("priorities of selected goals", // chart // title dataset, // data true, // include legend true, false); final org.jfree.chart.plot.PiePlot3D plot = (org.jfree.chart.plot.PiePlot3D) chart.getPlot(); plot.setStartAngle(290); plot.setDirection(Rotation.CLOCKWISE); plot.setForegroundAlpha(0.5f); plot.setNoDataMessage("No data to display"); plot.setLabelGenerator(new org.jfree.chart.labels.StandardPieSectionLabelGenerator("{0} = {2}", NumberFormat.getNumberInstance(), NumberFormat.getPercentInstance())); return chart; }
From source file:com.indicator_engine.controller.GraphController.java
private JFreeChart createPieChart(final PieDataset pdSet, final String chartTitle) { JFreeChart chart = ChartFactory.createPieChart3D(chartTitle, pdSet, true, true, false); PiePlot3D plot = (PiePlot3D) chart.getPlot(); plot.setStartAngle(290);//from w w w . j a va2 s . com plot.setDirection(Rotation.CLOCKWISE); plot.setForegroundAlpha(0.5f); PieSectionLabelGenerator gen = new StandardPieSectionLabelGenerator("{0}: {1} ({2})", new DecimalFormat("0"), new DecimalFormat("0%")); plot.setLabelGenerator(gen); return chart; }
From source file:org.gvsig.symbology.fmap.symbols.PieChart3DSymbol.java
protected Plot getMapPlot() { if (mapPlot == null) { PiePlot3D myMapPlot; try {/* w w w.ja v a 2s. c o m*/ myMapPlot = (PiePlot3D) getOutlinePlot().clone(); } catch (CloneNotSupportedException e) { Logger.getLogger(getClass()).error("Error cloning the PieChartSymbol's plot, check consistency"); myMapPlot = new PiePlot3D(); } myMapPlot.setBackgroundPaint(null); myMapPlot.setOutlinePaint(null); myMapPlot.setLabelBackgroundPaint(null); myMapPlot.setLabelGenerator(null); myMapPlot.setLabelLinksVisible(false); mapPlot = myMapPlot; } return mapPlot; }
From source file:org.jfree.eastwood.ChartEngine.java
/** * Creates a pie chart with 3D effect.// w ww . j av a 2 s.c o m * * @return A pie chart. */ private static JFreeChart createPieChart3D() { JFreeChart chart = ChartFactory.createPieChart3D(null, null, false, true, false); chart.setBackgroundPaint(Color.white); chart.setBorderPaint(Color.white); PiePlot3D plot = (PiePlot3D) chart.getPlot(); plot.setInsets(RectangleInsets.ZERO_INSETS); plot.setDarkerSides(true); plot.setBaseSectionOutlinePaint(new Color(0, 0, 0, 0)); plot.setStartAngle(0.0); plot.setInteriorGap(0.10); plot.setLabelGenerator(null); plot.setOutlineVisible(false); plot.setLabelBackgroundPaint(Color.white); plot.setLabelOutlinePaint(null); plot.setLabelShadowPaint(null); plot.setLabelPadding(RectangleInsets.ZERO_INSETS); plot.setLabelFont(new Font("Dialog", Font.PLAIN, 12)); plot.setLabelPaint(Color.darkGray); plot.setToolTipGenerator(new StandardPieToolTipGenerator("{2}")); return chart; }
From source file:org.squale.squaleweb.util.graph.PieChartMaker.java
/** * Factorisation du code commun la gnration du graphe * /*from w w w .j a v a 2 s . com*/ * @param pRequest la requte * @return graphe de type Bubble */ private JFreeChart getCommonChart(HttpServletRequest pRequest) { JFreeChart chart = ChartFactory.createPieChart3D(mTitle, mDataSet, false, false, false); PiePlot3D pieplot3d = (PiePlot3D) chart.getPlot(); final double startAngle = 290D; pieplot3d.setStartAngle(startAngle); final float depthFactor = 0.1f; pieplot3d.setDepthFactor(depthFactor); pieplot3d.setDirection(Rotation.CLOCKWISE); final float foregroundAlpha = 0.5f; pieplot3d.setForegroundAlpha(foregroundAlpha); // Si on est en anglais, on laisse les nombre formates avec des "," pour sparer les milliers // Si on est en francais on remplace les "," par des points NumberFormat numberFormat = SqualeWebActionUtils.getNumberFormat(pRequest); // Pour le formatter de %, on laisse celui par dfaut pieplot3d.setLabelGenerator(new StandardPieSectionLabelGenerator("{0} = {1} loc ({2})", numberFormat, NumberFormat.getPercentInstance())); return chart; }
From source file:edu.wpi.cs.wpisuitetng.modules.requirementsmanager.view.charts.StatView.java
/** * method to update the displayed chart based on the user's selection *///from ww w . j a v a2 s . co m public void updateChart() { JFreeChart chart = null; AbstractRequirementStatistics stats = null; // initialize the stats based on the type of data which the user has // selected switch (chartDataType) { case STATUS: stats = new StatusRequirementStatistics(); break; case ITERATION: stats = new IterationRequirementStatistics(); break; case ASSIGNEE: stats = new AssigneeRequirementStatistics(); break; case ESTIMATES: stats = new EstimateRequirementStatistics(); break; case EFFORT: stats = new ActualRequirementStatistics(); break; case VELOCITY: stats = new VelocityIterationStatistics(); break; case TASK: stats = new TaskRequirementStatistics(); break; default: // if you encounter this default statement, it means that new // values // have been // added to the DataType enum, but nobody has modified this poor // little method } // build the chart based on the type of chart the user has selected switch (chartType) { case BAR: // TODO: determine if additional modifications need to be // made // to the plot chart = stats.buildBarChart(); final CategoryPlot barPlot = (CategoryPlot) chart.getPlot(); barPlot.setNoDataMessage("No data available"); break; case PIE: chart = stats.buildPieChart(); final PiePlot3D piePlot = (PiePlot3D) chart.getPlot(); piePlot.setLabelFont(new Font("SansSerif", Font.PLAIN, 12)); piePlot.setNoDataMessage("No data available"); piePlot.setCircular(true); piePlot.setLabelGap(0.02); piePlot.setForegroundAlpha(0.7f); final PieSectionLabelGenerator generator = new StandardPieSectionLabelGenerator("{0} = {1} ({2})"); piePlot.setLabelGenerator(generator); break; case LINE: chart = stats.buildLineChart(); final CategoryPlot linePlot = (CategoryPlot) chart.getPlot(); linePlot.setNoDataMessage("No data available"); default: // if you encounter this default statement, it means that new // values have been added to the ChartType enum, but nobody has // modified this poor little method } // add the newly generated chart to the panel final JSplitPane mainPane = (JSplitPane) getComponent(0); final ChartPanel chartPanel = (ChartPanel) mainPane.getLeftComponent(); chartPanel.setChart(chart); return; }
From source file:com.uttesh.pdfngreport.handler.PdfReportHandler.java
/** * This method will generate the chart image file by using the Jfree chart * library/*from w ww. j av a 2 s . c om*/ * * @param dataSet * @throws FileNotFoundException * @throws IOException * * @see DefaultPieDataset */ public void generateChart(DefaultPieDataset dataSet, String os) throws FileNotFoundException, IOException { try { JFreeChart chart = ChartFactory.createPieChart3D("", dataSet, true, true, false); ChartStyle.theme(chart); PiePlot3D plot = (PiePlot3D) chart.getPlot(); plot.setForegroundAlpha(0.6f); plot.setCircular(true); plot.setSectionPaint("Passed", Color.decode("#019244")); plot.setSectionPaint("Failed", Color.decode("#EE6044")); plot.setSectionPaint("Skipped", Color.decode("#F0AD4E")); Color transparent = new Color(0.0f, 0.0f, 0.0f, 0.0f); plot.setLabelOutlinePaint(transparent); plot.setLabelBackgroundPaint(transparent); plot.setLabelShadowPaint(transparent); plot.setLabelLinkPaint(Color.GRAY); Font font = new Font("SansSerif", Font.PLAIN, 10); plot.setLabelFont(font); PieSectionLabelGenerator gen = new StandardPieSectionLabelGenerator("{0}: {1} ({2})", new DecimalFormat("0"), new DecimalFormat("0%")); plot.setLabelGenerator(gen); if (os != null && os.equalsIgnoreCase("w")) { ChartUtilities.saveChartAsPNG( new File(reportLocation + Constants.BACKWARD_SLASH + Constants.REPORT_CHART_FILE), chart, 560, 200); } else { ChartUtilities.saveChartAsPNG( new File(reportLocation + Constants.FORWARD_SLASH + Constants.REPORT_CHART_FILE), chart, 560, 200); } } catch (Exception e) { e.printStackTrace(System.err); if (os != null && os.equalsIgnoreCase("w")) { new File(reportLocation + Constants.BACKWARD_SLASH + Constants.REPORT_CHART_FILE).delete(); } else { new File(reportLocation + Constants.FORWARD_SLASH + Constants.REPORT_CHART_FILE).delete(); } System.exit(-1); } }
From source file:com.pureinfo.srm.reports.impl.PieChartBuilder.java
/** * @throws PureException/*w w w . ja va2s. c om*/ * @see com.pureinfo.srm.reports.IChartBuilder#draw(java.util.List, int) */ public JFreeChart buildChart() { Iterator result = m_datas.iterator(); DefaultPieDataset ds = getDataset(result); JFreeChart jfreechart = ChartFactory.createPieChart3D(null, ds, false, false, false); jfreechart.setBackgroundPaint(Color.WHITE); PiePlot3D pieplot3d = (PiePlot3D) jfreechart.getPlot(); pieplot3d.setOutlinePaint(Color.GRAY); pieplot3d.setOutlineStroke(new BasicStroke(1)); pieplot3d.setStartAngle(30D); pieplot3d.setDepthFactor(0.04); pieplot3d.setDrawingSupplier(new DefaultDrawingSupplier(MyPaintMgr.getPaints(), DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE, DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE, DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE, DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE)); pieplot3d.setCircular(false); pieplot3d.setDirection(Rotation.CLOCKWISE); pieplot3d.setOutlinePaint(Color.WHITE); pieplot3d.setInteriorGap(.15); Color color = new Color(0xaa, 0xaa, 0xaa, 255); pieplot3d.setBaseSectionOutlinePaint(color); pieplot3d.setBaseSectionOutlineStroke(new BasicStroke(0)); pieplot3d.setForegroundAlpha(0.6f); pieplot3d.setLabelLinkStroke(new BasicStroke(1)); pieplot3d.setLabelOutlinePaint(new Color(0x777777)); pieplot3d.setLabelBackgroundPaint(new Color(0xf1f1f7)); pieplot3d.setLabelLinkPaint(new Color(0xaa, 0xaa, 0xaa, 60)); pieplot3d.setNoDataMessage("No data to display"); pieplot3d.setLabelShadowPaint(new Color(0xdddddd)); pieplot3d.setLabelFont(new Font("", Font.PLAIN, 10)); if (m_nType == TYPE_PERCENT) { pieplot3d.setLabelGenerator(new StandardPieItemLabelGenerator("{0} = {2}", NumberFormat.getNumberInstance(), PERCENT_NUMBER_FORMAT)); } fillChartInfo(ds); return jfreechart; }
From source file:net.sf.jasperreports.engine.fill.DefaultChartTheme.java
/** * *///ww w. jav a2 s. c o m protected JFreeChart createPie3DChart() throws JRException { ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme()); JFreeChart jfreeChart = ChartFactory.createPieChart3D( evaluateTextExpression(getChart().getTitleExpression()), (PieDataset) getDataset(), isShowLegend(), true, false); configureChart(jfreeChart); PiePlot3D piePlot3D = (PiePlot3D) jfreeChart.getPlot(); //plot.setStartAngle(290); //plot.setDirection(Rotation.CLOCKWISE); //plot.setNoDataMessage("No data to display"); JRPie3DPlot jrPie3DPlot = (JRPie3DPlot) getPlot(); double depthFactor = jrPie3DPlot.getDepthFactorDouble() == null ? JRPie3DPlot.DEPTH_FACTOR_DEFAULT : jrPie3DPlot.getDepthFactorDouble(); boolean isCircular = jrPie3DPlot.getCircular() == null ? false : jrPie3DPlot.getCircular(); piePlot3D.setDepthFactor(depthFactor); piePlot3D.setCircular(isCircular); boolean isShowLabels = jrPie3DPlot.getShowLabels() == null ? true : jrPie3DPlot.getShowLabels(); if (isShowLabels) { PieSectionLabelGenerator labelGenerator = (PieSectionLabelGenerator) getLabelGenerator(); JRItemLabel itemLabel = jrPie3DPlot.getItemLabel(); if (labelGenerator != null) { piePlot3D.setLabelGenerator(labelGenerator); } else if (jrPie3DPlot.getLabelFormat() != null) { piePlot3D.setLabelGenerator(new StandardPieSectionLabelGenerator(jrPie3DPlot.getLabelFormat(), NumberFormat.getNumberInstance(getLocale()), NumberFormat.getPercentInstance(getLocale()))); } // the default section label is just the key, so there's no need to set localized number formats // else if (itemLabel != null && itemLabel.getMask() != null) // { // piePlot3D.setLabelGenerator( // new StandardPieSectionLabelGenerator(itemLabel.getMask()) // ); // } piePlot3D.setLabelFont( fontUtil.getAwtFont(getFont(itemLabel == null ? null : itemLabel.getFont()), getLocale())); if (itemLabel != null && itemLabel.getColor() != null) { piePlot3D.setLabelPaint(itemLabel.getColor()); } else { piePlot3D.setLabelPaint(getChart().getForecolor()); } if (itemLabel != null && itemLabel.getBackgroundColor() != null) { piePlot3D.setLabelBackgroundPaint(itemLabel.getBackgroundColor()); } else { piePlot3D.setLabelBackgroundPaint(getChart().getBackcolor()); } } else { piePlot3D.setLabelGenerator(null); } if (jrPie3DPlot.getLegendLabelFormat() != null) { piePlot3D.setLegendLabelGenerator(new StandardPieSectionLabelGenerator( jrPie3DPlot.getLegendLabelFormat(), NumberFormat.getNumberInstance(getLocale()), NumberFormat.getPercentInstance(getLocale()))); } // the default legend label is just the key, so there's no need to set localized number formats return jfreeChart; }