List of usage examples for org.jfree.chart.plot PiePlot3D setLabelOutlinePaint
public void setLabelOutlinePaint(Paint paint)
From source file:org.cyberoam.iview.charts.CustomToolTipGeneratorForDiskUsage.java
/** * This method generates JFreeChart instance for 3D Pie chart with iView customization. * @param reportID specifies that for which report Chart is being prepared. * @param rsw specifies data set which would be used for the Chart * @param requeest used for Hyperlink generation from uri. * @return jfreechart instance with iView Customization. *///from ww w.jav a 2 s.co m public static JFreeChart getChart(int reportID, ResultSetWrapper rsw, HttpServletRequest request) { boolean xFlag = false; ReportBean reportBean = ReportBean.getRecordbyPrimarykey(reportID); JFreeChart chart = null; try { ReportColumnBean reportColumnBean, reportColumnBeanX = null; GraphBean graphBean = null; DataLinkBean dataLinkBean = null; DefaultPieDataset dataset = new DefaultPieDataset(); graphBean = GraphBean.getRecordbyPrimarykey(reportBean.getGraphId());//Getting GraphBean reportColumnBeanX = ReportColumnBean.getRecordByPrimaryKey(reportBean.getReportId(), graphBean.getXColumnId());//getting ReportColumnBean For X Axis // String xColumnDBname = reportColumnBeanX.getDbColumnName(); if (reportColumnBeanX.getDataLinkId() != -1) { dataLinkBean = DataLinkBean.getRecordbyPrimarykey(reportColumnBeanX.getDataLinkId()); } reportColumnBean = ReportColumnBean.getRecordByPrimaryKey(reportBean.getReportId(), graphBean.getZColumnId()); rsw.beforeFirst(); reportColumnBean = ReportColumnBean.getRecordByPrimaryKey(reportBean.getReportId(), graphBean.getYColumnId()); String yColumnName = reportColumnBean.getColumnName(); if (dataLinkBean == null && reportColumnBean.getDataLinkId() != -1) { dataLinkBean = DataLinkBean.getRecordbyPrimarykey(reportColumnBean.getDataLinkId()); } String xData = null; while (rsw.next()) { xData = rsw.getString(reportColumnBeanX.getDbColumnName()); if (xData == null || "".equalsIgnoreCase(xData) || "null".equalsIgnoreCase(xData)) { xData = "N/A"; } else if (reportColumnBeanX.getColumnFormat() == TabularReportConstants.PROTOCOL_FORMATTING && xData.indexOf(':') != -1) { String data = data = ProtocolBean.getProtocolNameById(Integer.parseInt( rsw.getString(reportColumnBeanX.getDbColumnName()).substring(0, xData.indexOf(':')))); xData = data + rsw.getString(reportColumnBeanX.getDbColumnName()).substring(xData.indexOf(':'), xData.length()); } dataset.setValue(xData, new Long(rsw.getLong(reportColumnBean.getDbColumnName()))); } chart = ChartFactory.createPieChart3D("", // chart title dataset, // data true, // include legend true, // tooltips? false // URLs? ); /* *Setting additional customization to the chart. */ //Set the background color for the chart... chart.setBackgroundPaint(Color.white); //Get a reference to the plot for further customisation... PiePlot3D plot = (PiePlot3D) chart.getPlot(); plot.setBackgroundPaint(Color.white); plot.setBackgroundAlpha(0.0f); plot.setSectionOutlinesVisible(false); plot.setOutlineVisible(false); plot.setStartAngle(290); plot.setDepthFactor(0.1); plot.setDirection(Rotation.CLOCKWISE); plot.setNoDataMessage("No data to display"); plot.setSectionOutlinesVisible(false); plot.setSectionOutlinePaint(Color.white); plot.setOutlineVisible(false); plot.setExplodePercent(dataset.getKey(0), 0.3); plot.setLabelLinkPaint(Color.gray); plot.setLabelBackgroundPaint(Color.white); plot.setLabelFont(new Font("Arial", Font.CENTER_BASELINE, 10)); plot.setLabelOutlinePaint(Color.white); plot.setLabelShadowPaint(Color.white); LegendTitle legend = chart.getLegend(); legend.setItemFont(new Font("Arial", Font.CENTER_BASELINE, 10)); legend.setMargin(0, 0, 2, 0); legend.setHorizontalAlignment(HorizontalAlignment.CENTER); plot.setToolTipGenerator(new CustomToolTipGeneratorForPie3D("{0}: ({1} " + yColumnName + ", {2})")); //Setting Color try { plot.setSectionPaint(dataset.getKey(0), new Color(0, 0, 254)); plot.setSectionPaint(dataset.getKey(1), new Color(255, 0, 254)); plot.setSectionPaint(dataset.getKey(2), new Color(176, 176, 255)); plot.setSectionPaint(dataset.getKey(3), new Color(255, 170, 255)); plot.setSectionPaint(dataset.getKey(4), new Color(69, 153, 204)); } catch (Exception e) { } } catch (Exception e) { CyberoamLogger.appLog.debug("Pie3D.e:" + e, e); } return chart; }
From source file:org.cyberoam.iview.charts.CustomToolTipGeneratorForPie3D.java
/** * This method generates JFreeChart instance for 3D Pie chart with iView customization. * @param reportID specifies that for which report Chart is being prepared. * @param rsw specifies data set which would be used for the Chart * @param requeest used for Hyperlink generation from uri. * @return jfreechart instance with iView Customization. *//* w w w. j a v a 2s . c om*/ public static JFreeChart getChart(int reportID, ResultSetWrapper rsw, HttpServletRequest request) { boolean xFlag = false; ReportBean reportBean = ReportBean.getRecordbyPrimarykey(reportID); JFreeChart chart = null; try { ReportColumnBean reportColumnBean, reportColumnBeanX = null; GraphBean graphBean = null; DataLinkBean dataLinkBean = null; DefaultPieDataset dataset = new DefaultPieDataset(); graphBean = GraphBean.getRecordbyPrimarykey(reportBean.getGraphId());//Getting GraphBean reportColumnBeanX = ReportColumnBean.getRecordByPrimaryKey(reportBean.getReportId(), graphBean.getXColumnId());//getting ReportColumnBean For X Axis // String xColumnDBname = reportColumnBeanX.getDbColumnName(); if (reportColumnBeanX.getDataLinkId() != -1) { dataLinkBean = DataLinkBean.getRecordbyPrimarykey(reportColumnBeanX.getDataLinkId()); } reportColumnBean = ReportColumnBean.getRecordByPrimaryKey(reportBean.getReportId(), graphBean.getZColumnId()); rsw.beforeFirst(); reportColumnBean = ReportColumnBean.getRecordByPrimaryKey(reportBean.getReportId(), graphBean.getYColumnId()); String yColumnName = reportColumnBean.getColumnName(); if (dataLinkBean == null && reportColumnBean.getDataLinkId() != -1) { dataLinkBean = DataLinkBean.getRecordbyPrimarykey(reportColumnBean.getDataLinkId()); } String xData = null; while (rsw.next()) { xData = rsw.getString(reportColumnBeanX.getDbColumnName()); if (xData == null || "".equalsIgnoreCase(xData) || "null".equalsIgnoreCase(xData)) { xData = "N/A"; } else if (reportColumnBeanX.getColumnFormat() == TabularReportConstants.PROTOCOL_FORMATTING && xData.indexOf(':') != -1) { String data = data = ProtocolBean.getProtocolNameById(Integer.parseInt( rsw.getString(reportColumnBeanX.getDbColumnName()).substring(0, xData.indexOf(':')))); xData = data + rsw.getString(reportColumnBeanX.getDbColumnName()).substring(xData.indexOf(':'), xData.length()); } dataset.setValue(xData, new Long(rsw.getLong(reportColumnBean.getDbColumnName()))); } chart = ChartFactory.createPieChart3D("", // chart title dataset, // data true, // include legend true, // tooltips? false // URLs? ); /* *Setting additional customization to the chart. */ //Set the background color for the chart... chart.setBackgroundPaint(Color.white); //Get a reference to the plot for further customisation... PiePlot3D plot = (PiePlot3D) chart.getPlot(); plot.setBackgroundPaint(Color.white); plot.setBackgroundAlpha(0.0f); plot.setSectionOutlinesVisible(false); plot.setOutlineVisible(false); plot.setStartAngle(290); plot.setDepthFactor(0.1); plot.setDirection(Rotation.CLOCKWISE); plot.setNoDataMessage("No data to display"); plot.setSectionOutlinesVisible(false); plot.setSectionOutlinePaint(Color.white); plot.setOutlineVisible(false); plot.setExplodePercent(dataset.getKey(0), 0.3); plot.setLabelLinkPaint(Color.gray); plot.setLabelBackgroundPaint(Color.white); plot.setLabelFont(new Font("Arial", Font.CENTER_BASELINE, 10)); plot.setLabelOutlinePaint(Color.white); plot.setLabelShadowPaint(Color.white); LegendTitle legend = chart.getLegend(); legend.setItemFont(new Font("Arial", Font.CENTER_BASELINE, 10)); legend.setMargin(0, 0, 2, 0); legend.setHorizontalAlignment(HorizontalAlignment.CENTER); plot.setToolTipGenerator(new CustomToolTipGeneratorForPie3D("{0}: ({1} " + yColumnName + ", {2})")); //Setting Color try { plot.setSectionPaint(dataset.getKey(0), Pie3D.pieSections[0]); plot.setSectionPaint(dataset.getKey(1), Pie3D.pieSections[1]); plot.setSectionPaint(dataset.getKey(2), Pie3D.pieSections[2]); plot.setSectionPaint(dataset.getKey(3), Pie3D.pieSections[3]); plot.setSectionPaint(dataset.getKey(4), Pie3D.pieSections[4]); } catch (Exception e) { } } catch (Exception e) { CyberoamLogger.appLog.debug("Pie3D.e:" + e, e); } return chart; }
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 ava2 s . c o m*/ * * @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:org.jfree.eastwood.ChartEngine.java
/** * Creates a pie chart with 3D effect./* w w w .jav a 2 s . co 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:net.sf.fspdfs.chartthemes.spring.AegeanChartTheme.java
/** * *//*from ww w . j a v a2s .c om*/ 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:com.pureinfo.srm.reports.impl.PieChartBuilder.java
/** * @throws PureException//from ww w .ja v a 2 s.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: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 ww . j a v a 2 s . com 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:com.tocea.scertify.eclipse.scertifycode.ui.stats.views.GraphStatsView.java
/** * Cre le graphe JFreeChart.// www . j a v a2s. c o m * * @param piedataset * : la source de donnes afficher * @return le diagramme */ private JFreeChart createChart(final GraphPieDataset piedataset) { final JFreeChart jfreechart = ChartFactory.createPieChart3D(null, piedataset, false, true, false); jfreechart.setAntiAlias(true); jfreechart.setTextAntiAlias(true); final PiePlot3D pieplot3d = (PiePlot3D) 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.setBackgroundAlpha(0.0F); pieplot3d.setNoDataMessage(Messages.GraphStatsView_noDataToDisplay); 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:net.sf.fspdfs.chartthemes.spring.EyeCandySixtiesChartTheme.java
/** * */// w ww . ja va 2s . c om 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); }/* w w w. j a va2s.co 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; }