List of usage examples for java.awt Font CENTER_BASELINE
int CENTER_BASELINE
To view the source code for java.awt Font CENTER_BASELINE.
Click Source Link
From source file:com.baidu.rigel.biplatform.ma.auth.resource.RandomValidateCode.java
private static Font getFont() { return new Font("Fixedsys", Font.CENTER_BASELINE, 18); }
From source file:com.globalsight.util.JfreeCharUtil.java
public static void drawPieChart2D(String title, Map<String, Double> datas, File OutFile) { PieDataset dataset = buildDatas(datas); JFreeChart chart = ChartFactory.createPieChart(title, dataset, true, true, false); PiePlot plot = (PiePlot) chart.getPlot(); plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0}={1}({2})", NumberFormat.getNumberInstance(), new DecimalFormat("0.00%"))); plot.setLegendLabelGenerator(new StandardPieSectionLabelGenerator("{0}={1}({2})")); chart.setBackgroundPaint(Color.white); plot.setCircular(true);//from ww w. j a v a 2 s .c om TextTitle textTitle = new TextTitle(title); Font font = new Font(textTitle.getFont().getName(), Font.CENTER_BASELINE, 20); textTitle.setFont(font); chart.setTitle(textTitle); FileOutputStream fos_jpg = null; try { fos_jpg = new FileOutputStream(OutFile); ChartUtilities.writeChartAsJPEG(fos_jpg, 1, chart, 640, 480, null); fos_jpg.close(); } catch (Exception e) { s_logger.error(e.getMessage(), e); } }
From source file:com.globalsight.util.JfreeCharUtil.java
public static void drawPieChart3D(String title, Map<String, Double> datas, File OutFile) { PieDataset dataset = buildDatas(datas); JFreeChart chart = ChartFactory.createPieChart3D(title, dataset, true, true, false); PiePlot3D plot = (PiePlot3D) chart.getPlot(); plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0}={1}({2})", NumberFormat.getNumberInstance(), new DecimalFormat("0.00%"))); plot.setLegendLabelGenerator(new StandardPieSectionLabelGenerator("{0}={1}({2})")); chart.setBackgroundPaint(Color.white); plot.setForegroundAlpha(0.7f);// w ww . j a va2 s. c om plot.setCircular(true); TextTitle textTitle = new TextTitle(title); Font font = new Font(textTitle.getFont().getName(), Font.CENTER_BASELINE, 20); textTitle.setFont(font); chart.setTitle(textTitle); FileOutputStream fos_jpg = null; try { fos_jpg = new FileOutputStream(OutFile); ChartUtilities.writeChartAsJPEG(fos_jpg, 1, chart, 640, 480, null); fos_jpg.close(); } catch (Exception e) { s_logger.error(e.getMessage(), e); } }
From source file:org.cyberoam.iview.charts.Thermometer.java
/** * This method generates JFreeChart instance for Thermometer chart with iView customization. * @param reportID/*from w w w. ja v a2 s . c om*/ * @param rsw * @param request * @return */ public static JFreeChart getChart(int reportID, ResultSetWrapper rsw, HttpServletRequest request) { ReportBean reportBean = ReportBean.getRecordbyPrimarykey(reportID); JFreeChart chart = null; ReportColumnBean reportColumnBean = null; GraphBean graphBean = null; try { DefaultValueDataset dataset = null; graphBean = GraphBean.getRecordbyPrimarykey(reportBean.getGraphId()); reportColumnBean = ReportColumnBean.getRecordByPrimaryKey(reportBean.getReportId(), graphBean.getYColumnId()); String yColumnDBname = reportColumnBean.getDbColumnName(); rsw.first(); double used = Double.parseDouble(rsw.getString(yColumnDBname)); rsw.next(); double free = Double.parseDouble(rsw.getString(yColumnDBname)); dataset = new DefaultValueDataset((100 * used) / (used + free)); ThermometerPlot plot = new ThermometerPlot(dataset); chart = new JFreeChart("", // chart title JFreeChart.DEFAULT_TITLE_FONT, plot, // plot false); // include legend chart.setBackgroundPaint(Color.white); plot.setThermometerStroke(new BasicStroke(2.0f)); plot.setThermometerPaint(Color.DARK_GRAY); plot.setBulbRadius(30); plot.setColumnRadius(15); plot.setUnits(ThermometerPlot.UNITS_NONE); plot.setMercuryPaint(Color.WHITE); plot.setValueFont(new Font("Vandara", Font.CENTER_BASELINE, 12)); plot.setBackgroundPaint(Color.white); plot.setBackgroundAlpha(0.0f); plot.setOutlineVisible(false); plot.setSubrangeInfo(0, 0, 50); plot.setSubrangeInfo(1, 50, 85); plot.setSubrangeInfo(2, 85, 100); plot.setSubrangePaint(0, new Color(75, 200, 85)); plot.setSubrangePaint(1, new Color(254, 211, 41)); plot.setSubrangePaint(2, new Color(255, 85, 85)); } catch (Exception e) { CyberoamLogger.appLog.debug("Thermometer=>getChart.exception : " + e, e); } return chart; }
From source file:org.foxbpm.engine.impl.diagramview.svg.builder.LanesetSVGBuilder.java
public void setTextFont(String fontStr) { if (StringUtils.isBlank(fontStr)) { Font font = new Font(ARIAL, Font.CENTER_BASELINE, 11); this.textVO.setFont(font); return;//w w w .j av a 2 s .com } String[] fonts = fontStr.split(COMMA); StringBuffer styleBuffer = new StringBuffer(); String style = styleBuffer.append("font-family:").append(fonts[0]).append(";font-size:").append(fonts[1]) .toString(); Font font = new Font(fonts[0], Font.PLAIN, Integer.valueOf(fonts[1])); this.textVO.setFont(font); this.textVO.setStyle(style); this.textVO.setFontSize(fonts[1]); }
From source file:org.cyberoam.iview.charts.MeterChart.java
/** * This method generates JFreeChart instance for Meter chart with dial port and iView customization. * @param reportID/*from w w w.j a va 2 s . com*/ * @param rsw * @param request * @return */ public static JFreeChart getChart(int reportID, ResultSetWrapper rsw, HttpServletRequest request) { ReportBean reportBean = ReportBean.getRecordbyPrimarykey(reportID); JFreeChart chart = null; ReportColumnBean reportColumnBean = null; GraphBean graphBean = null; try { DefaultValueDataset data = null; graphBean = GraphBean.getRecordbyPrimarykey(reportBean.getGraphId()); reportColumnBean = ReportColumnBean.getRecordByPrimaryKey(reportBean.getReportId(), graphBean.getYColumnId()); String yColumnDBname = reportColumnBean.getDbColumnName(); rsw.first(); double used = Double.parseDouble(rsw.getString(yColumnDBname)); data = new DefaultValueDataset(100 - used); DialPlot plot = new DialPlot(data); chart = new JFreeChart("", JFreeChart.DEFAULT_TITLE_FONT, plot, false); chart.setBackgroundPaint(Color.white); int imgWidth = graphBean.getWidth(); int imgHeight = graphBean.getHeight(); if (request != null && request.getParameter("imgwidth") != null && !"".equalsIgnoreCase(request.getParameter("imgwidth")) && !"null".equalsIgnoreCase(request.getParameter("imgwidth"))) { imgWidth = Integer.parseInt(request.getParameter("imgwidth")); } if (request != null && request.getParameter("imgheight") != null && !"".equalsIgnoreCase(request.getParameter("imgheight")) && !"null".equalsIgnoreCase(request.getParameter("imgheight"))) { imgHeight = Integer.parseInt(request.getParameter("imgheight")); } plot.setView((1 - ((double) imgWidth / (double) imgHeight)) / 2, plot.getViewY(), ((double) imgWidth / (double) imgHeight), plot.getViewHeight()); StandardDialFrame dialFrame = new StandardDialFrame(); dialFrame.setBackgroundPaint(new Color(54, 73, 109)); dialFrame.setRadius(0.8); dialFrame.setStroke(new BasicStroke(0)); plot.setDialFrame(dialFrame); GradientPaint gp = new GradientPaint(new Point(), new Color(255, 255, 255), new Point(), new Color(196, 210, 219)); DialBackground db = new DialBackground(gp); db.setGradientPaintTransformer( new StandardGradientPaintTransformer(GradientPaintTransformType.VERTICAL)); plot.setBackground(db); DialValueIndicator dvi = new DialValueIndicator(0); dvi.setRadius(0.55); dvi.setBackgroundPaint(gp); dvi.setNumberFormat(new DecimalFormat("###")); dvi.setFont(new Font("Vandara", Font.CENTER_BASELINE, 10)); dvi.setOutlinePaint(Color.lightGray); plot.addLayer(dvi); StandardDialScale scale = new StandardDialScale(0, 100, -120, -300, 10, 4); scale.setTickRadius(0.75); scale.setTickLabelOffset(0.15); scale.setTickLabelFont(new Font("Vandara", Font.CENTER_BASELINE, 9)); plot.addScale(0, scale); StandardDialRange range = new StandardDialRange(0.0, 50.0, Color.green); range.setInnerRadius(0.35); range.setOuterRadius(0.38); plot.addLayer(range); StandardDialRange range2 = new StandardDialRange(50.0, 75.0, Color.yellow); range2.setInnerRadius(0.35); range2.setOuterRadius(0.38); plot.addLayer(range2); StandardDialRange range3 = new StandardDialRange(75.0, 100.0, Color.red); range3.setInnerRadius(0.35); range3.setOuterRadius(0.38); plot.addLayer(range3); DialPointer needle = new DialPointer.Pointer(); needle.setRadius(0.55); plot.addLayer(needle); DialCap cap = new DialCap(); cap.setRadius(0.05); plot.setCap(cap); } catch (Exception e) { CyberoamLogger.appLog.debug("MeterChart=>Exception : " + e, e); } return chart; }
From source file:org.cyberoam.iview.charts.XYLine.java
/** * This method generates JFreeChart instance for XYLine 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 URL. * @return jfreechart instance with iView Customization. */// www . java 2 s . c om public static JFreeChart getChart(int reportID, ResultSetWrapper rsw, HttpServletRequest request) { ReportBean reportBean = ReportBean.getRecordbyPrimarykey(reportID); JFreeChart chart = null; try { ReportColumnBean reportColumnBean = null; GraphBean graphBean = null; DataLinkBean dataLinkBean = null; XYDataset dataset = null; XYSeriesCollection seriesCollection = new XYSeriesCollection(); XYSeries series = new XYSeries(reportBean.getTitle()); graphBean = GraphBean.getRecordbyPrimarykey(reportBean.getGraphId());//Getting GraphBean reportColumnBean = ReportColumnBean.getRecordByPrimaryKey(reportBean.getReportId(), graphBean.getXColumnId());//getting ReportColumnBean For X Axis String xColumnDBname = reportColumnBean.getDbColumnName(); String xColumnName = reportColumnBean.getColumnName(); //Wheather DataLink is Given For X Axis column if (reportColumnBean.getDataLinkId() != -1) { dataLinkBean = DataLinkBean.getRecordbyPrimarykey(reportColumnBean.getDataLinkId()); } reportColumnBean = ReportColumnBean.getRecordByPrimaryKey(reportBean.getReportId(), graphBean.getYColumnId()); String yColumnDBname = reportColumnBean.getDbColumnName(); String yColumnName = reportColumnBean.getColumnName(); //if DataLink is not Given For X Axis column then Check of Y Axis Column if (dataLinkBean == null && reportColumnBean.getDataLinkId() != -1) { dataLinkBean = DataLinkBean.getRecordbyPrimarykey(reportColumnBean.getDataLinkId()); } reportColumnBean = ReportColumnBean.getRecordByPrimaryKey(reportBean.getReportId(), graphBean.getZColumnId()); String zColumnDbname = reportColumnBean.getDbColumnName(); //Preparing DataSet String data = ""; rsw.beforeFirst(); while (rsw.next()) { data = rsw.getString(xColumnDBname); series.add(Long.parseLong((data).substring(data.length() - 2)), new Long(rsw.getLong(yColumnDBname)).longValue()); } seriesCollection.addSeries(series); dataset = seriesCollection; // create the chart... chart = ChartFactory.createXYLineChart("", // chart title "", // domain axis label "", seriesCollection, // data PlotOrientation.VERTICAL, // orientation false, // include legend true, // tooltips? false // URLs? ); /* * Additional iView Customization. */ //Set the background color for the chart... chart.setBackgroundPaint(Color.white); //Get a reference to the plot for further customisation... XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(new Color(245, 245, 245)); plot.setDomainGridlinePaint(Color.LIGHT_GRAY); plot.setDomainGridlinesVisible(true); plot.setRangeGridlinePaint(Color.LIGHT_GRAY); plot.setForegroundAlpha(0.7f); //Set the range axis to display integers only... NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); if (reportColumnBean.getColumnFormat() == TabularReportConstants.BYTE_FORMATTING) { rangeAxis.setTickUnit(new ByteTickUnit(rangeAxis.getUpperBound() / 4)); } rangeAxis.setStandardTickUnits(NumberAxis.createStandardTickUnits()); rangeAxis.setTickLabelFont(new Font("Vandara", Font.CENTER_BASELINE, 10)); rangeAxis.setTickLabelsVisible(true); rangeAxis.setTickMarksVisible(false); rangeAxis.setAxisLineVisible(false); Axis domainAxis = plot.getDomainAxis(); domainAxis.setTickLabelFont(new Font("Vandara", Font.CENTER_BASELINE, 10)); domainAxis.setTickMarksVisible(false); domainAxis.setAxisLineVisible(false); XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer(); renderer.setSeriesPaint(0, Color.DARK_GRAY); renderer.setSeriesStroke(0, new BasicStroke(1)); } catch (Exception e) { e.printStackTrace(); } return chart; }
From source file:org.cyberoam.iview.charts.CustomDomainAxis.java
public static JFreeChart getChart(int reportID, ResultSetWrapper rsw, HttpServletRequest request) { ReportBean reportBean = ReportBean.getRecordbyPrimarykey(reportID); JFreeChart chart = null;//w ww. j a v a 2 s .c o m // DefaultCategoryDataset dataset=null; CustomCategoryDataset datasetCustom = null; try { ReportColumnBean reportColumnBeanX = null; ReportColumnBean reportColumnBeanY = null; ReportColumnBean reportColumnBeanZ = null; GraphBean graphBean = null; graphBean = GraphBean.getRecordbyPrimarykey(reportBean.getGraphId()); reportColumnBeanX = ReportColumnBean.getRecordByPrimaryKey(reportBean.getReportId(), graphBean.getXColumnId());//getting ReportColumnBean For X Axis String xColumnDBname = reportColumnBeanX.getDbColumnName(); reportColumnBeanY = ReportColumnBean.getRecordByPrimaryKey(reportBean.getReportId(), graphBean.getYColumnId()); String yColumnDBname = reportColumnBeanY.getDbColumnName(); String zColumnDBname = null; datasetCustom = new CustomCategoryDataset(); rsw.beforeFirst(); String data = ""; int count = -1; Boolean showLegend = false; if (graphBean.getZColumnId() == -1) { while (rsw.next()) { data = rsw.getString(xColumnDBname); datasetCustom.addValue(rsw.getLong(yColumnDBname), "", data); } } else { String zData; showLegend = true; reportColumnBeanZ = ReportColumnBean.getRecordByPrimaryKey(reportBean.getReportId(), graphBean.getZColumnId()); zColumnDBname = reportColumnBeanZ.getDbColumnName(); while (rsw.next()) { data = rsw.getString(xColumnDBname); zData = rsw.getString(zColumnDBname); datasetCustom.addValue(rsw.getLong(yColumnDBname), zData, data); count++; } } chart = ChartFactory.createLineChart("", // chart title "", // domain axis label "", // range axis label datasetCustom, // data PlotOrientation.VERTICAL, // orientation showLegend, // include legend true, // tooltips false // urls ); LegendTitle legendTitle = chart.getLegend(); if (legendTitle != null) legendTitle.setItemFont(new Font("Vandara", Font.BOLD, 11)); chart.setBackgroundPaint(Color.white); CategoryPlot plot = chart.getCategoryPlot(); plot.setBackgroundPaint(Color.white); plot.setDomainGridlinePaint(Color.LIGHT_GRAY); plot.setDomainGridlinesVisible(true); plot.setRangeGridlinePaint(Color.LIGHT_GRAY); plot.setAxisOffset(new RectangleInsets(0, 0, 0, 0)); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createStandardTickUnits()); rangeAxis.setTickLabelFont(new Font("Vandara", Font.CENTER_BASELINE, 10)); rangeAxis.setTickLabelInsets(new RectangleInsets(0, 0, 0, 5)); rangeAxis.setTickLabelsVisible(true); rangeAxis.setTickMarksVisible(false); rangeAxis.setAxisLineVisible(false); CustomDomainAxis catAxis = new CustomDomainAxis(); CustomDomainAxis.counter = 0; CustomDomainAxis.colCount = datasetCustom.getColumnCount(); catAxis.setTickLabelFont(new Font("Arial", Font.CENTER_BASELINE, 10)); catAxis.setTickMarksVisible(false); catAxis.setTickLabelInsets(new RectangleInsets(10, 15, 30, 10)); catAxis.setAxisLineVisible(false); catAxis.setCategoryLabelPositions( CategoryLabelPositions.createUpRotationLabelPositions(20 * Math.PI / 180)); plot.setDomainAxis(catAxis); final LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer(); renderer.setSeriesPaint(0, Color.DARK_GRAY); if (count > 0) { Color[] colors = null; colors = new Color[5]; colors[0] = new Color(24, 112, 176); colors[1] = new Color(168, 192, 232); colors[2] = new Color(248, 120, 8); colors[3] = new Color(248, 184, 120); colors[4] = new Color(152, 216, 136); for (int i = 0; i < count && i < colors.length; i++) renderer.setSeriesPaint(i, colors[i]); } } catch (Exception e) { CyberoamLogger.appLog.debug("LineChart: " + e.getMessage(), e); } return chart; }
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. */// ww w . ja v a2 s .com 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. *///from w ww . 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; }