List of usage examples for org.jfree.chart.plot PiePlot3D setCircular
public void setCircular(boolean flag)
From source file:org.gvsig.symbology.fmap.symbols.PieChart3DSymbol.java
protected Plot getOutlinePlot() { if (outlinePlot == null) { PiePlot3D myMapPlot = new PiePlot3D(); myMapPlot.setLabelGap(0);//from w w w. j a v a2s.c o m myMapPlot.setIgnoreZeroValues(ignoreZeroValues); updateDataset(); myMapPlot.setDataset(new DefaultPieDataset(dataset)); myMapPlot.setDirection(clockwise ? Rotation.CLOCKWISE : Rotation.ANTICLOCKWISE); myMapPlot.setDepthFactor(depthFactor); myMapPlot.setMinimumArcAngleToDraw(minimumAngleToDraw); myMapPlot.setCircular(circular); myMapPlot.setStartAngle(getRotation()); /* * myMapPlot.setDarkerSides(false); // requires jfreechart 1.0.10 * myMapPlot.setForegroundAlpha(foregroundAlpha); // requires * jfreechart 1.0.10 */ outlinePlot = myMapPlot; } return outlinePlot; }
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 */// w ww . java 2s. c o 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.pureinfo.srm.reports.impl.PieChartBuilder.java
/** * @throws PureException// w w w . ja v a2s . co m * @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:org.sonar.plugins.abacus.chart.PieChart3D.java
@Override protected Plot getPlot(ChartParameters params) { PiePlot3D plot = new PiePlot3D(); String[] colorsHex = params.getValues(PARAM_COLORS, ",", true); String[] serie = params.getValues(PARAM_VALUES, ";", true); DefaultPieDataset set = new DefaultPieDataset(); Color[] colors = COLORS;/*from w w w .ja va 2 s . c om*/ if (colorsHex != null && colorsHex.length > 0) { colors = new Color[colorsHex.length]; for (int i = 0; i < colorsHex.length; i++) { colors[i] = Color.decode("#" + colorsHex[i]); } } String[] keyValue = null; for (int i = 0; i < serie.length; i++) { if (!StringUtils.isEmpty(serie[i])) { keyValue = StringUtils.split(serie[i], "="); set.setValue(keyValue[0], Double.parseDouble(keyValue[1])); plot.setSectionPaint(keyValue[0], colors[i]); } } plot.setDataset(set); plot.setStartAngle(360); plot.setCircular(true); plot.setDirection(Rotation.CLOCKWISE); plot.setNoDataMessage(DEFAULT_MESSAGE_NODATA); plot.setInsets(RectangleInsets.ZERO_INSETS); plot.setForegroundAlpha(1.0f); plot.setBackgroundAlpha(0.0f); plot.setIgnoreNullValues(true); plot.setIgnoreZeroValues(true); plot.setOutlinePaint(Color.WHITE); plot.setShadowPaint(Color.WHITE); plot.setDarkerSides(false); plot.setLabelFont(DEFAULT_FONT); plot.setLabelPaint(Color.BLACK); plot.setLabelBackgroundPaint(Color.WHITE); plot.setLabelOutlinePaint(Color.WHITE); plot.setLabelShadowPaint(Color.WHITE); plot.setLabelPadding(new RectangleInsets(1, 1, 1, 1)); plot.setInteriorGap(0.02); plot.setMaximumLabelWidth(0.15); return plot; }
From source file:org.sonar.plugins.scmstats.charts.PieChart3D.java
@Override protected Plot getPlot(ChartParameters params) { PiePlot3D plot = new PiePlot3D(); String[] colorsHex = params.getValues(PARAM_COLORS, ",", true); String[] serie = params.getValues(PARAM_VALUES, ";", true); DefaultPieDataset set = new DefaultPieDataset(); Color[] colors = COLORS;//from w w w . j a v a 2 s .com if (colorsHex != null && colorsHex.length > 0) { colors = new Color[colorsHex.length]; for (int i = 0; i < colorsHex.length; i++) { colors[i] = Color.decode("#" + colorsHex[i]); } } String[] keyValue = null; for (int i = 0; i < serie.length; i++) { if (!StringUtils.isEmpty(serie[i])) { keyValue = StringUtils.split(serie[i], "="); set.setValue(keyValue[0], Double.parseDouble(keyValue[1])); plot.setSectionPaint(keyValue[0], colors[i]); } } plot.setDataset(set); plot.setStartAngle(180); plot.setCircular(true); plot.setDirection(Rotation.CLOCKWISE); plot.setNoDataMessage(DEFAULT_MESSAGE_NODATA); plot.setInsets(RectangleInsets.ZERO_INSETS); plot.setForegroundAlpha(1.0f); plot.setBackgroundAlpha(0.0f); plot.setIgnoreNullValues(true); plot.setIgnoreZeroValues(true); plot.setOutlinePaint(Color.WHITE); plot.setShadowPaint(Color.GREEN); plot.setDarkerSides(true); plot.setLabelFont(DEFAULT_FONT); plot.setLabelPaint(Color.BLACK); plot.setLabelBackgroundPaint(Color.WHITE); plot.setLabelOutlinePaint(Color.WHITE); plot.setLabelShadowPaint(Color.GRAY); plot.setLabelPadding(new RectangleInsets(1, 1, 1, 1)); plot.setInteriorGap(0.01); plot.setMaximumLabelWidth(0.25); return plot; }
From source file:net.sf.fspdfs.chartthemes.spring.AegeanChartTheme.java
/** * *//*from w w w. java2s .c o m*/ protected JFreeChart createPie3DChart() throws JRException { JFreeChart jfreeChart = super.createPie3DChart(); PiePlot3D piePlot3D = (PiePlot3D) jfreeChart.getPlot(); piePlot3D.setLabelBackgroundPaint(ChartThemesConstants.TRANSPARENT_PAINT); piePlot3D.setLabelShadowPaint(ChartThemesConstants.TRANSPARENT_PAINT); piePlot3D.setLabelOutlinePaint(ChartThemesConstants.TRANSPARENT_PAINT); piePlot3D.setDarkerSides(true); piePlot3D.setDepthFactor(0.07); //does not work for 3D // piePlot3D.setShadowXOffset(5); // piePlot3D.setShadowYOffset(10); // piePlot3D.setShadowPaint(new GradientPaint( // 0, // getChart().getHeight() / 2, // new Color(41, 120, 162), // 0, // getChart().getHeight(), // Color.white) // ); PieDataset pieDataset = piePlot3D.getDataset(); if (pieDataset != null) { for (int i = 0; i < pieDataset.getItemCount(); i++) { piePlot3D.setSectionOutlinePaint(pieDataset.getKey(i), ChartThemesConstants.TRANSPARENT_PAINT); } } piePlot3D.setCircular(true); return jfreeChart; }
From source file:net.sf.jasperreports.chartthemes.spring.AegeanChartTheme.java
@Override protected JFreeChart createPie3DChart() throws JRException { JFreeChart jfreeChart = super.createPie3DChart(); PiePlot3D piePlot3D = (PiePlot3D) jfreeChart.getPlot(); JRPie3DPlot jrPiePlot = (JRPie3DPlot) getPlot(); boolean isShowLabels = jrPiePlot.getShowLabels() == null ? true : jrPiePlot.getShowLabels(); if (isShowLabels && piePlot3D.getLabelGenerator() != null) { piePlot3D.setLabelBackgroundPaint(ChartThemesConstants.TRANSPARENT_PAINT); piePlot3D.setLabelShadowPaint(ChartThemesConstants.TRANSPARENT_PAINT); piePlot3D.setLabelOutlinePaint(ChartThemesConstants.TRANSPARENT_PAINT); }//from w w w. j av a 2 s.c om piePlot3D.setDarkerSides(true); piePlot3D.setDepthFactor(0.07); //does not work for 3D // piePlot3D.setShadowXOffset(5); // piePlot3D.setShadowYOffset(10); // piePlot3D.setShadowPaint(new GradientPaint( // 0, // getChart().getHeight() / 2, // new Color(41, 120, 162), // 0, // getChart().getHeight(), // Color.white) // ); PieDataset pieDataset = piePlot3D.getDataset(); if (pieDataset != null) { for (int i = 0; i < pieDataset.getItemCount(); i++) { piePlot3D.setSectionOutlinePaint(pieDataset.getKey(i), ChartThemesConstants.TRANSPARENT_PAINT); } } piePlot3D.setCircular(true); return jfreeChart; }
From source file:net.sf.fspdfs.chartthemes.spring.EyeCandySixtiesChartTheme.java
/** * *///from ww w .ja v a2 s . co m protected JFreeChart createPie3DChart() throws JRException { JFreeChart jfreeChart = super.createPie3DChart(); PiePlot3D piePlot3D = (PiePlot3D) jfreeChart.getPlot(); piePlot3D.setLabelBackgroundPaint(ChartThemesConstants.TRANSPARENT_PAINT); piePlot3D.setLabelShadowPaint(ChartThemesConstants.TRANSPARENT_PAINT); piePlot3D.setLabelOutlinePaint(ChartThemesConstants.TRANSPARENT_PAINT); piePlot3D.setDarkerSides(true); piePlot3D.setDepthFactor(0.1); // does not work for 3D // piePlot3D.setShadowXOffset(5); // piePlot3D.setShadowYOffset(10); // piePlot3D.setShadowPaint(new GradientPaint( // 0, // getChart().getHeight() / 2, // new Color(41, 120, 162), // 0, // getChart().getHeight(), // Color.white) // ); PieDataset pieDataset = piePlot3D.getDataset(); if (pieDataset != null) { for (int i = 0; i < pieDataset.getItemCount(); i++) { piePlot3D.setSectionOutlinePaint(pieDataset.getKey(i), ChartThemesConstants.TRANSPARENT_PAINT); } } piePlot3D.setCircular(true); return jfreeChart; }
From source file:net.sf.jasperreports.chartthemes.spring.EyeCandySixtiesChartTheme.java
@Override protected JFreeChart createPie3DChart() throws JRException { JFreeChart jfreeChart = super.createPie3DChart(); PiePlot3D piePlot3D = (PiePlot3D) jfreeChart.getPlot(); JRPie3DPlot jrPiePlot = (JRPie3DPlot) getPlot(); boolean isShowLabels = jrPiePlot.getShowLabels() == null ? true : jrPiePlot.getShowLabels(); if (isShowLabels && piePlot3D.getLabelGenerator() != null) { piePlot3D.setLabelBackgroundPaint(ChartThemesConstants.TRANSPARENT_PAINT); piePlot3D.setLabelShadowPaint(ChartThemesConstants.TRANSPARENT_PAINT); piePlot3D.setLabelOutlinePaint(ChartThemesConstants.TRANSPARENT_PAINT); }//from w ww .j a va 2 s . c o m piePlot3D.setDarkerSides(true); piePlot3D.setDepthFactor(0.1); // does not work for 3D // piePlot3D.setShadowXOffset(5); // piePlot3D.setShadowYOffset(10); // piePlot3D.setShadowPaint(new GradientPaint( // 0, // getChart().getHeight() / 2, // new Color(41, 120, 162), // 0, // getChart().getHeight(), // Color.white) // ); PieDataset pieDataset = piePlot3D.getDataset(); if (pieDataset != null) { for (int i = 0; i < pieDataset.getItemCount(); i++) { piePlot3D.setSectionOutlinePaint(pieDataset.getKey(i), ChartThemesConstants.TRANSPARENT_PAINT); } } piePlot3D.setCircular(true); return jfreeChart; }
From source file:net.sf.jasperreports.engine.fill.DefaultChartTheme.java
/** * *//* w ww. j a v a 2s. 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; }