List of usage examples for org.jfree.chart.plot PiePlot3D setDepthFactor
public void setDepthFactor(double factor)
From source file:net.sf.jasperreports.chartthemes.spring.GenericChartTheme.java
/** * */// w w w. jav 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, getPlot()); 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()))); } // else if (itemLabel != null && itemLabel.getMask() != null) // { // piePlot3D.setLabelGenerator( // new StandardPieSectionLabelGenerator(itemLabel.getMask()) // ); // } else { piePlot3D.setLabelGenerator(new StandardPieSectionLabelGenerator()); } Integer baseFontSize = (Integer) getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.BASEFONT_SIZE); JRFont font = itemLabel != null && itemLabel.getFont() != null ? itemLabel.getFont() : null; piePlot3D.setLabelFont(getFont(new JRBaseFont(getChart(), null), font, baseFontSize)); 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()))); } return jfreeChart; }
From source file:net.sf.jasperreports.chartthemes.simple.SimpleChartTheme.java
/** * */// ww w .jav a 2 s . c om protected JFreeChart createPie3DChart() throws JRException { ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme()); JFreeChart jfreeChart = ChartFactory.createPieChart3D( evaluateTextExpression(getChart().getTitleExpression()), (PieDataset) getDataset(), isShowLegend(), true, false); configureChart(jfreeChart, getPlot()); 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()))); } // else if (itemLabel != null && itemLabel.getMask() != null) // { // piePlot3D.setLabelGenerator( // new StandardPieSectionLabelGenerator(itemLabel.getMask()) // ); // } if (itemLabel != null && itemLabel.getFont() != null) { piePlot3D.setLabelFont(getFontUtil().getAwtFont(itemLabel.getFont(), getLocale())); } else { piePlot3D.setLabelFont(getFontUtil().getAwtFont(new JRBaseFont(getChart(), null), 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()))); } return jfreeChart; }