Java Code Examples for org.jfree.chart.plot.CategoryPlot#setRangeGridlinesVisible()
The following examples show how to use
org.jfree.chart.plot.CategoryPlot#setRangeGridlinesVisible() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NominalAttributeStatisticsModel.java From rapidminer-studio with GNU Affero General Public License v3.0 | 6 votes |
/** * Creates the histogram chart. * * @return */ private JFreeChart createBarChart() { JFreeChart chart = ChartFactory.createBarChart(null, null, null, createBarDataset(), PlotOrientation.VERTICAL, false, false, false); AbstractAttributeStatisticsModel.setDefaultChartFonts(chart); chart.setBackgroundPaint(null); chart.setBackgroundImageAlpha(0.0f); CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setRangeGridlinesVisible(false); plot.setDomainGridlinesVisible(false); plot.setOutlineVisible(false); plot.setRangeZeroBaselineVisible(false); plot.setDomainGridlinesVisible(false); plot.setBackgroundPaint(COLOR_INVISIBLE); plot.setBackgroundImageAlpha(0.0f); BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setSeriesPaint(0, AttributeGuiTools.getColorForValueType(Ontology.NOMINAL)); renderer.setBarPainter(new StandardBarPainter()); renderer.setDrawBarOutline(true); renderer.setShadowVisible(false); return chart; }
Example 2
Source File: BeltNominalColumnStatisticsModel.java From rapidminer-studio with GNU Affero General Public License v3.0 | 6 votes |
/** * Creates the histogram chart. */ private JFreeChart createBarChart() { JFreeChart chart = ChartFactory.createBarChart(null, null, null, createBarDataset(), PlotOrientation.VERTICAL, false, false, false); setDefaultChartFonts(chart); chart.setBackgroundPaint(null); chart.setBackgroundImageAlpha(0.0f); CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setRangeGridlinesVisible(false); plot.setDomainGridlinesVisible(false); plot.setOutlineVisible(false); plot.setRangeZeroBaselineVisible(false); plot.setDomainGridlinesVisible(false); plot.setBackgroundPaint(COLOR_INVISIBLE); plot.setBackgroundImageAlpha(0.0f); BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setSeriesPaint(0, AttributeGuiTools.getColorForValueType(Ontology.NOMINAL)); renderer.setBarPainter(new StandardBarPainter()); renderer.setDrawBarOutline(true); renderer.setShadowVisible(false); return chart; }
Example 3
Source File: LineChart.java From Knowage-Server with GNU Affero General Public License v3.0 | 4 votes |
public JFreeChart createChart(){ logger.debug("IN"); CategoryPlot plot = new CategoryPlot(); NumberAxis rangeAxis = new NumberAxis("Kpi Values"); rangeAxis.setLabelFont(new Font("Arial", Font.PLAIN, 12 )); Color colorLabel= Color.decode("#000000"); rangeAxis.setLabelPaint(colorLabel); rangeAxis.setTickLabelFont(new Font("Arial", Font.PLAIN, 10 )); rangeAxis.setTickLabelPaint(colorLabel); plot.setRangeAxis(rangeAxis); CategoryAxis domainAxis = new CategoryAxis(); domainAxis.setLabelFont(new Font("Arial", Font.PLAIN, 10 )); domainAxis.setLabelPaint(colorLabel); domainAxis.setTickLabelFont(new Font("Arial", Font.PLAIN, 10 )); domainAxis.setTickLabelPaint(colorLabel); plot.setDomainAxis(domainAxis); plot.setOrientation(PlotOrientation.VERTICAL); plot.setRangeGridlinesVisible(true); plot.setDomainGridlinesVisible(true); //I create a line renderer MyStandardCategoryItemLabelGenerator generator=null; LineAndShapeRenderer lineRenderer = new LineAndShapeRenderer(); lineRenderer.setShapesFilled(true); lineRenderer.setBaseItemLabelGenerator(generator); lineRenderer.setBaseItemLabelFont(new Font("Arial", Font.PLAIN, 12 )); lineRenderer.setBaseItemLabelPaint(colorLabel); lineRenderer.setBaseItemLabelsVisible(true); DefaultCategoryDataset datasetLine=(DefaultCategoryDataset)datasetMap.getDatasets().get("line"); for (Iterator iterator = datasetLine.getRowKeys().iterator(); iterator.hasNext();) { String serName = (String) iterator.next(); String labelName = ""; int index=-1; index=datasetLine.getRowIndex(serName); Color color=Color.decode("#990200"); lineRenderer.setSeriesPaint(index, color); } plot.setDataset(0,datasetLine); plot.setRenderer(0,lineRenderer); plot.getDomainAxis().setCategoryLabelPositions( CategoryLabelPositions.UP_45); JFreeChart chart = new JFreeChart(plot); logger.debug("Chart created"); TextTitle title=new TextTitle(name,new Font("Arial", Font.BOLD, 16 ),Color.decode("#990200"), RectangleEdge.TOP, HorizontalAlignment.CENTER, VerticalAlignment.TOP, RectangleInsets.ZERO_INSETS); chart.setTitle(title); TextTitle subTitle =new TextTitle(subName,new Font("Arial", Font.PLAIN, 12 ),Color.decode("#000000"), RectangleEdge.TOP, HorizontalAlignment.CENTER, VerticalAlignment.TOP, RectangleInsets.ZERO_INSETS); chart.addSubtitle(subTitle); TextTitle subTitle2 =new TextTitle(subName,new Font("Arial", Font.PLAIN, 8 ),Color.decode("#FFFFFF"), RectangleEdge.TOP, HorizontalAlignment.CENTER, VerticalAlignment.TOP, RectangleInsets.ZERO_INSETS); chart.addSubtitle(subTitle2); chart.removeLegend(); chart.setBackgroundPaint(Color.white); logger.debug("OUT"); return chart; }
Example 4
Source File: EyeCandySixtiesChartTheme.java From jasperreports with GNU Lesser General Public License v3.0 | 4 votes |
@Override protected JFreeChart createGanttChart() throws JRException { JFreeChart jfreeChart = super.createGanttChart(); CategoryPlot categoryPlot = (CategoryPlot)jfreeChart.getPlot(); categoryPlot.getDomainAxis().setCategoryLabelPositions(CategoryLabelPositions.STANDARD); categoryPlot.setDomainGridlinesVisible(true); categoryPlot.setDomainGridlinePosition(CategoryAnchor.END); categoryPlot.setDomainGridlineStroke(new BasicStroke( 0.5f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 50, new float[] {1}, 0 ) ); categoryPlot.setDomainGridlinePaint(ChartThemesConstants.GRAY_PAINT_134); categoryPlot.setRangeGridlinesVisible(true); categoryPlot.setRangeGridlineStroke(new BasicStroke( 0.5f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 50, new float[] {1}, 0 ) ); categoryPlot.setRangeGridlinePaint(ChartThemesConstants.GRAY_PAINT_134); categoryPlot.getDomainAxis().setTickLabelsVisible( //barPlot.isShowTickLabels() true ); CategoryItemRenderer categoryRenderer = categoryPlot.getRenderer(); categoryRenderer.setBaseItemLabelsVisible(true); BarRenderer barRenderer = (BarRenderer)categoryRenderer; barRenderer.setSeriesPaint(0, ChartThemesConstants.EYE_CANDY_SIXTIES_COLORS.get(3)); barRenderer.setSeriesPaint(1, ChartThemesConstants.EYE_CANDY_SIXTIES_COLORS.get(0)); CategoryDataset categoryDataset = categoryPlot.getDataset(); if (categoryDataset != null) { for (int i = 0; i < categoryDataset.getRowCount(); i++) { barRenderer.setSeriesItemLabelFont(i, categoryPlot.getDomainAxis().getTickLabelFont()); barRenderer.setSeriesItemLabelsVisible(i, true); } } categoryPlot.setOutlinePaint(Color.DARK_GRAY); categoryPlot.setOutlineStroke(new BasicStroke(1.5f)); categoryPlot.setOutlineVisible(true); return jfreeChart; }
Example 5
Source File: AegeanChartTheme.java From jasperreports with GNU Lesser General Public License v3.0 | 4 votes |
@Override protected JFreeChart createGanttChart() throws JRException { JFreeChart jfreeChart = super.createGanttChart(); CategoryPlot categoryPlot = (CategoryPlot)jfreeChart.getPlot(); categoryPlot.getDomainAxis().setCategoryLabelPositions(CategoryLabelPositions.STANDARD); categoryPlot.setDomainGridlinesVisible(true); categoryPlot.setDomainGridlinePosition(CategoryAnchor.END); categoryPlot.setDomainGridlineStroke(new BasicStroke( 0.5f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 50, new float[] {1}, 0 ) ); categoryPlot.setDomainGridlinePaint(ChartThemesConstants.GRAY_PAINT_217); categoryPlot.setRangeGridlinesVisible(true); categoryPlot.setRangeGridlineStroke(new BasicStroke( 0.5f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 50, new float[] {1}, 0 ) ); categoryPlot.setRangeGridlinePaint(ChartThemesConstants.GRAY_PAINT_217); // JRBarPlot barPlot = (BarPlot)categoryPlot; // categoryPlot.getDomainAxis().setTickLabelsVisible( // categoryPlot.getShowTickLabels() == null ? true : barPlot.getShowTickLabels(). // true // ); CategoryItemRenderer categoryRenderer = categoryPlot.getRenderer(); categoryRenderer.setBaseItemLabelsVisible(true); BarRenderer barRenderer = (BarRenderer)categoryRenderer; @SuppressWarnings("unchecked") List<Paint> seriesPaints = (List<Paint>)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.SERIES_COLORS); barRenderer.setSeriesPaint(0, seriesPaints.get(3)); barRenderer.setSeriesPaint(1, seriesPaints.get(0)); CategoryDataset categoryDataset = categoryPlot.getDataset(); if(categoryDataset != null) { for(int i = 0; i < categoryDataset.getRowCount(); i++) { barRenderer.setSeriesItemLabelFont(i, categoryPlot.getDomainAxis().getTickLabelFont()); barRenderer.setSeriesItemLabelsVisible(i, true); // barRenderer.setSeriesPaint(i, GRADIENT_PAINTS[i]); // CategoryMarker categoryMarker = new CategoryMarker(categoryDataset.getColumnKey(i),MARKER_COLOR, new BasicStroke(1f)); // categoryMarker.setAlpha(0.5f); // categoryPlot.addDomainMarker(categoryMarker, Layer.BACKGROUND); } } categoryPlot.setOutlinePaint(Color.DARK_GRAY); categoryPlot.setOutlineStroke(new BasicStroke(1.5f)); categoryPlot.setOutlineVisible(true); return jfreeChart; }
Example 6
Source File: ParetoChartPlotter.java From rapidminer-studio with GNU Affero General Public License v3.0 | 4 votes |
private JFreeChart createChart() { if (data.getItemCount() > 0) { // get cumulative percentages KeyedValues cumulative = DataUtilities.getCumulativePercentages(data); CategoryDataset categoryDataset = DatasetUtilities.createCategoryDataset( "Count for " + this.dataTable.getColumnName(this.countColumn) + " = " + countValue, data); // create the chart... final JFreeChart chart = ChartFactory.createBarChart(null, // chart title this.dataTable.getColumnName(this.groupByColumn), // domain axis label "Count", // range axis label categoryDataset, // data PlotOrientation.VERTICAL, true, // include legend true, false); // set the background color for the chart... chart.setBackgroundPaint(Color.WHITE); // get a reference to the plot for further customization... CategoryPlot plot = chart.getCategoryPlot(); CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setLowerMargin(0.02); domainAxis.setUpperMargin(0.02); domainAxis.setLabelFont(LABEL_FONT_BOLD); domainAxis.setTickLabelFont(LABEL_FONT); // set the range axis to display integers only... NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits(Locale.US)); rangeAxis.setLabelFont(LABEL_FONT_BOLD); rangeAxis.setTickLabelFont(LABEL_FONT); // second data set (cumulative percentages) CategoryDataset dataset2 = DatasetUtilities.createCategoryDataset("Cumulative (Percent)", cumulative); LineAndShapeRenderer renderer2 = new LineAndShapeRenderer(); renderer2.setSeriesPaint(0, SwingTools.VERY_DARK_BLUE.darker()); NumberAxis axis2 = new NumberAxis("Percent of " + countValue); axis2.setNumberFormatOverride(NumberFormat.getPercentInstance()); axis2.setLabelFont(LABEL_FONT_BOLD); axis2.setTickLabelFont(LABEL_FONT); plot.setRangeAxis(1, axis2); plot.setDataset(1, dataset2); plot.setRenderer(1, renderer2); plot.mapDatasetToRangeAxis(1, 1); axis2.setTickUnit(new NumberTickUnit(0.1)); // show grid lines plot.setRangeGridlinesVisible(true); // bring cumulative line to front plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); if (isLabelRotating()) { domainAxis.setTickLabelsVisible(true); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 2.0d)); } return chart; } else { return null; } }
Example 7
Source File: ServerWideReportManagerImpl.java From sakai with Educational Community License v2.0 | 4 votes |
private byte[] generateStackedAreaChart (CategoryDataset dataset, int width, int height) { JFreeChart chart = ChartFactory.createStackedAreaChart (null, // chart title null, // domain axis label null, // range axis label dataset, // data PlotOrientation.VERTICAL, // the plot orientation true, // legend true, // tooltips false // urls ); // set background chart.setBackgroundPaint (parseColor (statsManager.getChartBackgroundColor ())); // set chart border chart.setPadding (new RectangleInsets (10, 5, 5, 5)); chart.setBorderVisible (true); chart.setBorderPaint (parseColor ("#cccccc")); // set anti alias chart.setAntiAlias (true); CategoryPlot plot = (CategoryPlot) chart.getPlot (); // set transparency plot.setForegroundAlpha (0.7f); plot.setAxisOffset (new RectangleInsets (5.0, 5.0, 5.0, 5.0)); plot.setBackgroundPaint (Color.lightGray); plot.setDomainGridlinesVisible (true); plot.setDomainGridlinePaint (Color.white); plot.setRangeGridlinesVisible (true); plot.setRangeGridlinePaint (Color.white); // set colour of regular users using Karate belt colour: white, green, blue, brown, black/gold CategoryItemRenderer renderer = plot.getRenderer (); renderer.setSeriesPaint (0, new Color (205, 173, 0)); // gold users renderer.setSeriesPaint (1, new Color (139, 69, 19)); renderer.setSeriesPaint (2, Color.BLUE); renderer.setSeriesPaint (3, Color.GREEN); renderer.setSeriesPaint (4, Color.WHITE); // set the range axis to display integers only... NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis (); rangeAxis.setStandardTickUnits (NumberAxis.createIntegerTickUnits ()); CategoryAxis domainAxis = (CategoryAxis) plot.getDomainAxis (); domainAxis.setCategoryLabelPositions (CategoryLabelPositions.DOWN_45); domainAxis.setLowerMargin(0.0); domainAxis.setUpperMargin(0.0); BufferedImage img = chart.createBufferedImage (width, height); final ByteArrayOutputStream out = new ByteArrayOutputStream(); try{ ImageIO.write(img, "png", out); }catch(IOException e){ log.warn("Error occurred while generating SiteStats chart image data", e); } return out.toByteArray(); }
Example 8
Source File: ServerWideReportManagerImpl.java From sakai with Educational Community License v2.0 | 4 votes |
private byte[] createToolAnalysisChart (int width, int height) { CategoryDataset dataset = getToolAnalysisDataSet (); if (dataset == null) { return generateNoDataChart(width, height); } JFreeChart chart = ChartFactory.createBarChart ( null, // chart title null, // domain axis label null, // range axis label dataset, // data PlotOrientation.HORIZONTAL, // the plot orientation false, // legend false, // tooltips false // urls ); // set background chart.setBackgroundPaint (parseColor (statsManager.getChartBackgroundColor ())); // set chart border chart.setPadding (new RectangleInsets (10, 5, 5, 5)); chart.setBorderVisible (true); chart.setBorderPaint (parseColor ("#cccccc")); // set anti alias chart.setAntiAlias (true); CategoryPlot plot = (CategoryPlot) chart.getPlot (); // set transparency plot.setForegroundAlpha (0.7f); plot.setAxisOffset (new RectangleInsets (5.0, 5.0, 5.0, 5.0)); plot.setBackgroundPaint (Color.lightGray); plot.setDomainGridlinesVisible (false); plot.setRangeGridlinesVisible (true); plot.setRangeGridlinePaint (Color.white); CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setVisible(false); domainAxis.setUpperMargin (0); domainAxis.setLowerMargin (0); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setUpperMargin(0.20); rangeAxis.setStandardTickUnits (NumberAxis.createIntegerTickUnits ()); BarRenderer renderer = (BarRenderer) plot.getRenderer(); CategoryItemLabelGenerator generator = new StandardCategoryItemLabelGenerator("{1}", NumberFormat.getInstance(new ResourceLoader().getLocale())); renderer.setDefaultItemLabelGenerator(generator); renderer.setDefaultItemLabelFont(new Font("SansSerif", Font.PLAIN, 9)); renderer.setDefaultItemLabelsVisible(true); renderer.setItemMargin (0); renderer.setSeriesPaint (0, Color.BLUE); BufferedImage img = chart.createBufferedImage (width, height); final ByteArrayOutputStream out = new ByteArrayOutputStream(); try{ ImageIO.write(img, "png", out); }catch(IOException e){ log.warn("Error occurred while generating SiteStats chart image data", e); } return out.toByteArray(); }
Example 9
Source File: ChartJFreeChartOutputHistogram.java From gama with GNU General Public License v3.0 | 4 votes |
@Override public void initChart_post_data_init(final IScope scope) { // TODO Auto-generated method stub super.initChart_post_data_init(scope); final CategoryPlot pp = (CategoryPlot) chart.getPlot(); final String sty = getStyle(); this.useSubAxis = false; switch (sty) { case IKeyword.STACK: { if (this.series_label_position.equals("xaxis")) { this.series_label_position = "default"; } if (this.series_label_position.equals("default")) { this.series_label_position = "legend"; } break; } default: { if (this.series_label_position.equals("default")) { if (this.getChartdataset().getSources().size() > 0) { final ChartDataSource onesource = this.getChartdataset().getSources().get(0); if (onesource.isCumulative) { this.series_label_position = "legend"; } else { this.series_label_position = "xaxis"; useMainAxisLabel = false; } } else { this.series_label_position = "legend"; } } break; } } if (this.series_label_position.equals("xaxis")) { this.useSubAxis = true; } if (!this.series_label_position.equals("legend")) { chart.getLegend().setVisible(false); // legend is useless, but I find it nice anyway... Could put back... } this.resetDomainAxis(scope); pp.setDomainGridlinePaint(axesColor); pp.setRangeGridlinePaint(axesColor); if (!this.getXTickLineVisible(scope)) { pp.setDomainGridlinesVisible(false); } if (!this.getYTickLineVisible(scope)) { pp.setRangeGridlinesVisible(false); } pp.setRangeCrosshairVisible(true); pp.getRangeAxis().setAxisLinePaint(axesColor); pp.getRangeAxis().setLabelFont(getLabelFont()); pp.getRangeAxis().setTickLabelFont(getTickFont()); if (textColor != null) { pp.getRangeAxis().setLabelPaint(textColor); pp.getRangeAxis().setTickLabelPaint(textColor); } if (ytickunit > 0) { ((NumberAxis) pp.getRangeAxis()).setTickUnit(new NumberTickUnit(ytickunit)); } if (ylabel != null && !ylabel.isEmpty()) { pp.getRangeAxis().setLabel(ylabel); } if (this.series_label_position.equals("yaxis")) { pp.getRangeAxis().setLabel(this.getChartdataset().getDataSeriesIds(scope).iterator().next()); chart.getLegend().setVisible(false); } if (xlabel != null && !xlabel.isEmpty()) { pp.getDomainAxis().setLabel(xlabel); } if (textColor != null) { pp.getDomainAxis().setLabelPaint(textColor); pp.getDomainAxis().setTickLabelPaint(textColor); if (this.series_label_position.equals("xaxis")) { ((SubCategoryAxis)pp.getDomainAxis()).setSubLabelPaint(textColor); } } }
Example 10
Source File: ServerWideReportManagerImpl.java From sakai with Educational Community License v2.0 | 4 votes |
private byte[] generateStackedAreaChart (CategoryDataset dataset, int width, int height) { JFreeChart chart = ChartFactory.createStackedAreaChart (null, // chart title null, // domain axis label null, // range axis label dataset, // data PlotOrientation.VERTICAL, // the plot orientation true, // legend true, // tooltips false // urls ); // set background chart.setBackgroundPaint (parseColor (statsManager.getChartBackgroundColor ())); // set chart border chart.setPadding (new RectangleInsets (10, 5, 5, 5)); chart.setBorderVisible (true); chart.setBorderPaint (parseColor ("#cccccc")); // set anti alias chart.setAntiAlias (true); CategoryPlot plot = (CategoryPlot) chart.getPlot (); // set transparency plot.setForegroundAlpha (0.7f); plot.setAxisOffset (new RectangleInsets (5.0, 5.0, 5.0, 5.0)); plot.setBackgroundPaint (Color.lightGray); plot.setDomainGridlinesVisible (true); plot.setDomainGridlinePaint (Color.white); plot.setRangeGridlinesVisible (true); plot.setRangeGridlinePaint (Color.white); // set colour of regular users using Karate belt colour: white, green, blue, brown, black/gold CategoryItemRenderer renderer = plot.getRenderer (); renderer.setSeriesPaint (0, new Color (205, 173, 0)); // gold users renderer.setSeriesPaint (1, new Color (139, 69, 19)); renderer.setSeriesPaint (2, Color.BLUE); renderer.setSeriesPaint (3, Color.GREEN); renderer.setSeriesPaint (4, Color.WHITE); // set the range axis to display integers only... NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis (); rangeAxis.setStandardTickUnits (NumberAxis.createIntegerTickUnits ()); CategoryAxis domainAxis = (CategoryAxis) plot.getDomainAxis (); domainAxis.setCategoryLabelPositions (CategoryLabelPositions.DOWN_45); domainAxis.setLowerMargin(0.0); domainAxis.setUpperMargin(0.0); BufferedImage img = chart.createBufferedImage (width, height); final ByteArrayOutputStream out = new ByteArrayOutputStream(); try{ ImageIO.write(img, "png", out); }catch(IOException e){ log.warn("Error occurred while generating SiteStats chart image data", e); } return out.toByteArray(); }
Example 11
Source File: ServerWideReportManagerImpl.java From sakai with Educational Community License v2.0 | 4 votes |
private byte[] createToolAnalysisChart (int width, int height) { CategoryDataset dataset = getToolAnalysisDataSet (); if (dataset == null) { return generateNoDataChart(width, height); } JFreeChart chart = ChartFactory.createBarChart ( null, // chart title null, // domain axis label null, // range axis label dataset, // data PlotOrientation.HORIZONTAL, // the plot orientation false, // legend false, // tooltips false // urls ); // set background chart.setBackgroundPaint (parseColor (statsManager.getChartBackgroundColor ())); // set chart border chart.setPadding (new RectangleInsets (10, 5, 5, 5)); chart.setBorderVisible (true); chart.setBorderPaint (parseColor ("#cccccc")); // set anti alias chart.setAntiAlias (true); CategoryPlot plot = (CategoryPlot) chart.getPlot (); // set transparency plot.setForegroundAlpha (0.7f); plot.setAxisOffset (new RectangleInsets (5.0, 5.0, 5.0, 5.0)); plot.setBackgroundPaint (Color.lightGray); plot.setDomainGridlinesVisible (false); plot.setRangeGridlinesVisible (true); plot.setRangeGridlinePaint (Color.white); CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setVisible(false); domainAxis.setUpperMargin (0); domainAxis.setLowerMargin (0); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setUpperMargin(0.20); rangeAxis.setStandardTickUnits (NumberAxis.createIntegerTickUnits ()); BarRenderer renderer = (BarRenderer) plot.getRenderer(); CategoryItemLabelGenerator generator = new StandardCategoryItemLabelGenerator("{1}", NumberFormat.getInstance(new ResourceLoader().getLocale())); renderer.setDefaultItemLabelGenerator(generator); renderer.setDefaultItemLabelFont(new Font("SansSerif", Font.PLAIN, 9)); renderer.setDefaultItemLabelsVisible(true); renderer.setItemMargin (0); renderer.setSeriesPaint (0, Color.BLUE); BufferedImage img = chart.createBufferedImage (width, height); final ByteArrayOutputStream out = new ByteArrayOutputStream(); try{ ImageIO.write(img, "png", out); }catch(IOException e){ log.warn("Error occurred while generating SiteStats chart image data", e); } return out.toByteArray(); }