Example usage for org.jfree.chart JFreeChart setBorderPaint

List of usage examples for org.jfree.chart JFreeChart setBorderPaint

Introduction

In this page you can find the example usage for org.jfree.chart JFreeChart setBorderPaint.

Prototype

public void setBorderPaint(Paint paint) 

Source Link

Document

Sets the paint used to draw the chart border (if visible).

Usage

From source file:org.xwiki.chart.internal.ColorChartCustomizer.java

@Override
public void customize(JFreeChart jfchart, Map<String, String> parameters) {
    // Set the default colors to use if the user has specified some colors.
    DrawingSupplierFactory drawingSupplierFactory = new DrawingSupplierFactory();
    jfchart.getPlot().setDrawingSupplier(drawingSupplierFactory.createDrawingSupplier(parameters));

    // Set any plot background color if the user has specified one
    if (parameters.get(PLOT_BACKGROUND_COLOR) != null) {
        jfchart.getPlot().setBackgroundPaint(convertColor(parameters.get(PLOT_BACKGROUND_COLOR)));
    }/*from   w w  w.ja  v  a 2 s . co m*/

    // Set the non-plot area background color if specified
    if (parameters.get(BACKGROUND_COLOR) != null) {
        jfchart.setBackgroundPaint(convertColor(parameters.get(BACKGROUND_COLOR)));
    }

    // Set the legend background color if specified
    if (parameters.get(LEGEND_BACKGROUND_COLOR) != null) {
        jfchart.getLegend().setBackgroundPaint(convertColor(parameters.get(LEGEND_BACKGROUND_COLOR)));
    }

    // Set the plot border color if specified
    if (parameters.get(PLOT_BORDER_COLOR) != null) {
        jfchart.getPlot().setOutlinePaint(convertColor(parameters.get(PLOT_BORDER_COLOR)));
    }

    // Set the graph border color if specified
    if (parameters.get(BORDER_COLOR) != null) {
        jfchart.setBorderPaint(convertColor(parameters.get(BORDER_COLOR)));
    }
}

From source file:lucee.runtime.tag.Chart.java

private void setBorder(JFreeChart chart, Plot plot) {
    chart.setBorderVisible(false);/*from  w w  w .  j  a  v a2s . c o m*/
    chart.setBorderPaint(foregroundcolor);
    plot.setOutlinePaint(foregroundcolor);
}

From source file:lucee.runtime.tag.Chart.java

private void setBackground(JFreeChart chart, Plot plot) {
    //Color bg = backgroundcolor==null?databackgroundcolor:backgroundcolor;

    chart.setBackgroundPaint(backgroundcolor);
    plot.setBackgroundPaint(databackgroundcolor);
    chart.setBorderPaint(databackgroundcolor);

    plot.setOutlineVisible(false);//www  .ja  va 2s.  c om

    // Pie
    if (plot instanceof PiePlot) {
        PiePlot pp = (PiePlot) plot;
        pp.setLabelOutlinePaint(backgroundcolor);
        pp.setLabelBackgroundPaint(backgroundcolor);
        pp.setLabelShadowPaint(backgroundcolor);
        pp.setShadowPaint(backgroundcolor);
    }
    // Bar
    /*if(plot instanceof CategoryPlot) {
       CategoryPlot cp=(CategoryPlot) plot;
               
    }*/
}

From source file:org.sakaiproject.sitestats.impl.ServerWideReportManagerImpl.java

private byte[] generateBoxAndWhiskerChart(BoxAndWhiskerCategoryDataset dataset, int width, int height) {
    JFreeChart chart = ChartFactory.createBoxAndWhiskerChart(null, null, null, dataset, false);

    // set background
    chart.setBackgroundPaint(parseColor(statsManager.getChartBackgroundColor()));

    // set chart border
    chart.setPadding(new RectangleInsets(10, 5, 5, 5));
    chart.setBorderVisible(true);//w ww.  ja va 2s .  c  o  m
    chart.setBorderPaint(parseColor("#cccccc"));

    // set anti alias
    chart.setAntiAlias(true);

    CategoryPlot plot = (CategoryPlot) chart.getPlot();

    plot.setDomainGridlinePaint(Color.white);
    plot.setDomainGridlinesVisible(true);
    plot.setRangeGridlinePaint(Color.white);

    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    CategoryAxis domainAxis = (CategoryAxis) plot.getDomainAxis();
    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();
}

From source file:beproject.MainGUI.java

void liveTweetAnalysis() {
    new DataGenerator(1000).start();
    rate = new TimeSeries("Total count", Second.class);
    rate.setMaximumItemAge(15);//from w ww.ja v  a  2s  . c o  m
    TimeSeriesCollection dataset = new TimeSeriesCollection();
    dataset.addSeries(rate);
    DateAxis domain = new DateAxis("Time");
    NumberAxis range = new NumberAxis("Tweet Count");
    XYItemRenderer renderer = new XYLineAndShapeRenderer(true, false);
    renderer.setSeriesPaint(1, Color.BLUE);
    renderer.setSeriesStroke(0, new BasicStroke(3f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL));
    renderer.setSeriesStroke(1, new BasicStroke(3f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL));
    XYPlot plot = new XYPlot(dataset, domain, range, renderer);
    domain.setAutoRange(true);
    domain.setLowerMargin(0.0);
    domain.setUpperMargin(0.0);
    domain.setTickLabelsVisible(true);
    range.setTickLabelsVisible(true);

    plot.setDomainGridlinesVisible(false);
    range.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    renderer.setBaseItemLabelsVisible(true);

    JFreeChart liveTweetAnalysisChart = new JFreeChart("Tweets Per Second", new Font("Tahoma", Font.BOLD, 24),
            plot, true);
    liveTweetAnalysisChart.setBorderVisible(false);
    liveTweetAnalysisChart.setBorderPaint(null);

    ChartUtilities.applyCurrentTheme(liveTweetAnalysisChart);

    domain.setTickLabelInsets(RectangleInsets.ZERO_INSETS);
    range.setTickMarksVisible(false);
    range.setTickLabelInsets(RectangleInsets.ZERO_INSETS);
    domain.setTickMarksVisible(false);
    liveTweetAnalysisChart.setPadding(RectangleInsets.ZERO_INSETS);

    ChartPanel liveTweetAnalysisChartPanel = new ChartPanel(liveTweetAnalysisChart, true);
    liveTweetAnalysisChartPanel.setBorder(null);

    liveTweetsAnalysisPanel.add(liveTweetAnalysisChartPanel, BorderLayout.CENTER);
    liveTweetsAnalysisPanel.validate();
}

From source file:org.sakaiproject.sitestats.impl.ServerWideReportManagerImpl.java

private byte[] createWeeklyLoginChart(int width, int height) {
    IntervalXYDataset dataset1 = getWeeklyLoginsDataSet();
    IntervalXYDataset dataset2 = getWeeklySiteUserDataSet();

    if ((dataset1 == null) || (dataset2 == null)) {
        return generateNoDataChart(width, height);
    }/*from   w w  w  .j av  a2s.c  o  m*/

    // create plot ...
    XYItemRenderer renderer1 = new XYLineAndShapeRenderer(true, false);
    renderer1.setSeriesStroke(0, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL));
    renderer1.setSeriesStroke(1, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL));
    renderer1.setSeriesPaint(0, Color.RED);
    renderer1.setSeriesPaint(0, Color.BLUE);

    DateAxis domainAxis = new DateAxis("");
    domainAxis.setTickUnit(new DateTickUnit(DateTickUnit.DAY, 7, new SimpleDateFormat("yyyy-MM-dd")));
    domainAxis.setTickMarkPosition(DateTickMarkPosition.START);
    domainAxis.setVerticalTickLabels(true);
    domainAxis.setLowerMargin(0.01);
    domainAxis.setUpperMargin(0.01);

    NumberAxis rangeAxis = new NumberAxis("count");
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    XYPlot plot1 = new XYPlot(dataset1, null, rangeAxis, renderer1);
    plot1.setBackgroundPaint(Color.lightGray);
    plot1.setDomainGridlinePaint(Color.white);
    plot1.setRangeGridlinePaint(Color.white);

    // add a second dataset and renderer...
    XYItemRenderer renderer2 = new XYLineAndShapeRenderer(true, false);
    renderer2.setSeriesStroke(0, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL));
    renderer2.setSeriesStroke(1, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL));
    renderer2.setSeriesStroke(2, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL));
    renderer2.setSeriesPaint(0, Color.GREEN);
    renderer2.setSeriesPaint(1, Color.BLACK);
    renderer2.setSeriesPaint(2, Color.CYAN);

    rangeAxis = new NumberAxis("count");
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    XYPlot plot2 = new XYPlot(dataset2, null, rangeAxis, renderer2);
    plot2.setBackgroundPaint(Color.lightGray);
    plot2.setDomainGridlinePaint(Color.white);
    plot2.setRangeGridlinePaint(Color.white);

    CombinedDomainXYPlot cplot = new CombinedDomainXYPlot(domainAxis);
    cplot.add(plot1, 3);
    cplot.add(plot2, 2);
    cplot.setGap(8.0);
    cplot.setDomainGridlinePaint(Color.white);
    cplot.setDomainGridlinesVisible(true);

    // return a new chart containing the overlaid plot...
    JFreeChart chart = new JFreeChart(null, JFreeChart.DEFAULT_TITLE_FONT, cplot, false);
    LegendTitle legend = new LegendTitle(cplot);
    chart.addSubtitle(legend);

    // 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);

    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();
}

From source file:org.sakaiproject.sitestats.impl.ServerWideReportManagerImpl.java

private byte[] createDailyLoginChart(int width, int height) {
    IntervalXYDataset dataset1 = getDailyLoginsDataSet();
    IntervalXYDataset dataset2 = getDailySiteUserDataSet();

    if ((dataset1 == null) || (dataset2 == null)) {
        return generateNoDataChart(width, height);
    }//from ww  w . j a va 2s . c o m

    // create plot ...
    XYItemRenderer renderer1 = new XYLineAndShapeRenderer(true, false);
    renderer1.setSeriesPaint(0, Color.RED);
    renderer1.setSeriesPaint(1, Color.BLUE);
    renderer1.setSeriesPaint(2, Color.RED);
    renderer1.setSeriesPaint(3, Color.BLUE);
    renderer1.setSeriesStroke(0, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL));
    renderer1.setSeriesStroke(1, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL));
    BasicStroke dashLineStroke = new BasicStroke(2, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 0,
            new float[] { 4 }, 0);
    renderer1.setSeriesStroke(2, dashLineStroke);
    renderer1.setSeriesStroke(3, dashLineStroke);

    DateAxis domainAxis = new DateAxis("");
    domainAxis.setTickUnit(new DateTickUnit(DateTickUnit.DAY, 7, new SimpleDateFormat("yyyy-MM-dd")));
    domainAxis.setTickMarkPosition(DateTickMarkPosition.START);
    domainAxis.setVerticalTickLabels(true);
    domainAxis.setLowerMargin(0.01);
    domainAxis.setUpperMargin(0.01);

    NumberAxis rangeAxis = new NumberAxis("count");
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    XYPlot plot1 = new XYPlot(dataset1, null, rangeAxis, renderer1);
    plot1.setBackgroundPaint(Color.lightGray);
    plot1.setDomainGridlinePaint(Color.white);
    plot1.setRangeGridlinePaint(Color.white);

    // add a second dataset and renderer...
    XYItemRenderer renderer2 = new XYLineAndShapeRenderer(true, false);
    renderer2.setSeriesStroke(0, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL));
    renderer2.setSeriesStroke(1, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL));
    renderer2.setSeriesStroke(2, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL));
    renderer2.setSeriesPaint(0, Color.GREEN);
    renderer2.setSeriesPaint(1, Color.BLACK);
    renderer2.setSeriesPaint(2, Color.CYAN);

    rangeAxis = new NumberAxis("count");
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    XYPlot plot2 = new XYPlot(dataset2, null, rangeAxis, renderer2);
    plot2.setBackgroundPaint(Color.lightGray);
    plot2.setDomainGridlinePaint(Color.white);
    plot2.setRangeGridlinePaint(Color.white);

    CombinedDomainXYPlot cplot = new CombinedDomainXYPlot(domainAxis);
    cplot.add(plot1, 3);
    cplot.add(plot2, 2);
    cplot.setGap(8.0);
    cplot.setDomainGridlinePaint(Color.white);
    cplot.setDomainGridlinesVisible(true);

    // return a new chart containing the overlaid plot...
    JFreeChart chart = new JFreeChart(null, JFreeChart.DEFAULT_TITLE_FONT, cplot, false);
    LegendTitle legend = new LegendTitle(cplot);
    chart.addSubtitle(legend);

    // 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);

    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();
}

From source file:org.sakaiproject.sitestats.impl.ServerWideReportManagerImpl.java

private byte[] createMonthlyLoginChart(int width, int height) {
    IntervalXYDataset dataset1 = getMonthlyLoginsDataSet();
    IntervalXYDataset dataset3 = getMonthlySiteUserDataSet();

    if ((dataset1 == null) || (dataset3 == null)) {
        return generateNoDataChart(width, height);
    }/*from  w w  w.j a  v  a 2 s .co m*/

    // create plot ...
    XYItemRenderer renderer1 = new XYLineAndShapeRenderer(true, false);
    renderer1.setSeriesStroke(0, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL));
    renderer1.setSeriesPaint(0, Color.RED);

    DateAxis domainAxis = new DateAxis("");
    domainAxis.setTickUnit(new DateTickUnit(DateTickUnit.MONTH, 1, new SimpleDateFormat("yyyy-MM")));
    domainAxis.setTickMarkPosition(DateTickMarkPosition.START);
    domainAxis.setVerticalTickLabels(true);
    domainAxis.setLowerMargin(0.01);
    domainAxis.setUpperMargin(0.01);

    NumberAxis axis1 = new NumberAxis("Total Logins");
    axis1.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    axis1.setLabelPaint(Color.RED);
    axis1.setTickLabelPaint(Color.RED);

    XYPlot plot1 = new XYPlot(dataset1, null, axis1, renderer1);
    plot1.setBackgroundPaint(Color.lightGray);
    plot1.setDomainGridlinePaint(Color.white);
    plot1.setRangeGridlinePaint(Color.white);

    // AXIS 2
    /*
    NumberAxis axis2 = new NumberAxis("Total Unique Users");
    axis2.setStandardTickUnits (NumberAxis.createIntegerTickUnits ());
    axis2.setLabelPaint(Color.BLUE);
    axis2.setTickLabelPaint(Color.BLUE);
    plot1.setRangeAxis(1, axis2);
            
    plot1.setDataset(1, dataset2);
    plot1.mapDatasetToRangeAxis(1, 1);
    XYItemRenderer renderer2 = new XYLineAndShapeRenderer(true, false);
    renderer2.setSeriesStroke(0, new BasicStroke(2.0f, 
        BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL));
    renderer2.setSeriesPaint (0, Color.BLUE);
    plot1.setRenderer(1, renderer2);
    */

    // add a third dataset and renderer...
    XYItemRenderer renderer3 = new XYLineAndShapeRenderer(true, false);
    renderer3.setSeriesStroke(0, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL));
    renderer3.setSeriesStroke(1, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL));
    renderer3.setSeriesStroke(2, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL));
    renderer3.setSeriesPaint(0, Color.GREEN);
    renderer3.setSeriesPaint(1, Color.BLACK);
    renderer3.setSeriesPaint(2, Color.CYAN);

    axis1 = new NumberAxis("count");
    axis1.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    XYPlot plot2 = new XYPlot(dataset3, null, axis1, renderer3);
    plot2.setBackgroundPaint(Color.lightGray);
    plot2.setDomainGridlinePaint(Color.white);
    plot2.setRangeGridlinePaint(Color.white);

    CombinedDomainXYPlot cplot = new CombinedDomainXYPlot(domainAxis);
    cplot.add(plot1, 3);
    cplot.add(plot2, 2);
    cplot.setGap(8.0);
    cplot.setDomainGridlinePaint(Color.white);
    cplot.setDomainGridlinesVisible(true);

    // return a new chart containing the overlaid plot...
    JFreeChart chart = new JFreeChart(null, JFreeChart.DEFAULT_TITLE_FONT, cplot, false);
    LegendTitle legend = new LegendTitle(cplot);
    chart.addSubtitle(legend);

    // 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);

    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();
}

From source file:org.pentaho.plugin.jfreereport.reportcharts.AbstractChartExpression.java

protected void configureChart(final JFreeChart chart) {
    // Misc Properties
    final TextTitle chartTitle = chart.getTitle();
    if (chartTitle != null) {
        final Font titleFont = Font.decode(getTitleFont());
        chartTitle.setFont(titleFont);//from w w w .  j  a va  2 s  .com
    }

    if (isAntiAlias() == false) {
        chart.setAntiAlias(false);
    }

    chart.setBorderVisible(isShowBorder());

    final Color backgroundColor = parseColorFromString(getBackgroundColor());
    if (backgroundColor != null) {
        chart.setBackgroundPaint(backgroundColor);
    }

    if (plotBackgroundColor != null) {
        chart.getPlot().setBackgroundPaint(plotBackgroundColor);
    }
    chart.getPlot().setBackgroundAlpha(plotBackgroundAlpha);
    chart.getPlot().setForegroundAlpha(plotForegroundAlpha);
    final Color borderCol = parseColorFromString(getBorderColor());
    if (borderCol != null) {
        chart.setBorderPaint(borderCol);
    }

    //remove legend if showLegend = false
    if (!isShowLegend()) {
        chart.removeLegend();
    } else { //if true format legend
        final LegendTitle chLegend = chart.getLegend();
        if (chLegend != null) {
            final RectangleEdge loc = translateEdge(legendLocation.toLowerCase());
            if (loc != null) {
                chLegend.setPosition(loc);
            }
            if (getLegendFont() != null) {
                chLegend.setItemFont(Font.decode(getLegendFont()));
            }
            if (!isDrawLegendBorder()) {
                chLegend.setBorder(BlockBorder.NONE);
            }
            if (legendBackgroundColor != null) {
                chLegend.setBackgroundPaint(legendBackgroundColor);
            }
            if (legendTextColor != null) {
                chLegend.setItemPaint(legendTextColor);
            }
        }

    }

    final Plot plot = chart.getPlot();
    plot.setNoDataMessageFont(Font.decode(getLabelFont()));

    final String message = getNoDataMessage();
    if (message != null) {
        plot.setNoDataMessage(message);
    }

    plot.setOutlineVisible(isChartSectionOutline());

    if (backgroundImage != null) {
        if (plotImageCache != null) {
            plot.setBackgroundImage(plotImageCache);
        } else {
            final ExpressionRuntime expressionRuntime = getRuntime();
            final ProcessingContext context = expressionRuntime.getProcessingContext();
            final ResourceKey contentBase = context.getContentBase();
            final ResourceManager manager = context.getResourceManager();
            try {
                final ResourceKey key = createKeyFromString(manager, contentBase, backgroundImage);
                final Resource resource = manager.create(key, null, Image.class);
                final Image image = (Image) resource.getResource();
                plot.setBackgroundImage(image);
                plotImageCache = image;
            } catch (Exception e) {
                logger.error("ABSTRACTCHARTEXPRESSION.ERROR_0007_ERROR_RETRIEVING_PLOT_IMAGE", e); //$NON-NLS-1$
                throw new IllegalStateException("Failed to process chart");
            }
        }
    }
}

From source file:org.sakaiproject.sitestats.impl.ServerWideReportManagerImpl.java

private byte[] generateLayeredBarChart(CategoryDataset dataset, int width, int height) {
    JFreeChart chart = ChartFactory.createBarChart(null, // chart title
            null, // domain axis label
            null, // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // the plot orientation
            true, // legend
            true, // tooltips
            false // urls
    );/*from w  ww.j  a va 2  s  . c o m*/

    // 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();

    // disable bar outlines...
    LayeredBarRenderer renderer = new LayeredBarRenderer();
    renderer.setDrawBarOutline(false);
    renderer.setSeriesBarWidth(0, .6);
    renderer.setSeriesBarWidth(1, .8);
    renderer.setSeriesBarWidth(2, 1.0);
    plot.setRenderer(renderer);

    // for this renderer, we need to draw the first series last...
    plot.setRowRenderingOrder(SortOrder.DESCENDING);

    // set up gradient paints for series...
    GradientPaint gp0 = new GradientPaint(0.0f, 0.0f, Color.blue, 0.0f, 0.0f, new Color(0, 0, 64));
    GradientPaint gp1 = new GradientPaint(0.0f, 0.0f, Color.green, 0.0f, 0.0f, new Color(0, 64, 0));
    GradientPaint gp2 = new GradientPaint(0.0f, 0.0f, Color.red, 0.0f, 0.0f, new Color(64, 0, 0));
    renderer.setSeriesPaint(0, gp0);
    renderer.setSeriesPaint(1, gp1);
    renderer.setSeriesPaint(2, gp2);

    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();
}