Example usage for org.jfree.chart StandardChartTheme setChartBackgroundPaint

List of usage examples for org.jfree.chart StandardChartTheme setChartBackgroundPaint

Introduction

In this page you can find the example usage for org.jfree.chart StandardChartTheme setChartBackgroundPaint.

Prototype

public void setChartBackgroundPaint(Paint paint) 

Source Link

Document

Sets the chart background paint.

Usage

From source file:jamel.gui.charts.JamelChart.java

/**
 * Returns the standard chart theme./*from  w  ww . j  a  v a2s . c o m*/
 * @return the standard chart theme.
 */
private static StandardChartTheme getNewChartTheme() {
    StandardChartTheme theme = new StandardChartTheme("Standard Chart Theme");
    float size = theme.getExtraLargeFont().getSize2D();
    Font titleFont = theme.getExtraLargeFont().deriveFont(size - 4);
    theme.setExtraLargeFont(titleFont);
    Font axisFont = theme.getRegularFont();
    theme.setLargeFont(axisFont);
    theme.setChartBackgroundPaint(new Color(0, 0, 0, 1));
    theme.setPlotBackgroundPaint(Color.WHITE);
    theme.setDomainGridlinePaint(Color.GRAY);
    theme.setRangeGridlinePaint(Color.GRAY);
    return theme;
}

From source file:com.uttesh.pdfngreport.util.chart.ChartStyle.java

/**
 * this method will set the style theme for pie chart.
 *
 * @see org.jfree.chart.StandardChartTheme
 * @param chart//w  w  w.  j a  v a2 s  . com
 */
public static void theme(JFreeChart chart) {
    String fontName = "Lucida Sans";

    StandardChartTheme theme = (StandardChartTheme) org.jfree.chart.StandardChartTheme.createJFreeTheme();

    theme.setTitlePaint(Color.decode("#4572a7"));
    theme.setExtraLargeFont(new Font(fontName, Font.PLAIN, 16)); //title
    theme.setLargeFont(new Font(fontName, Font.BOLD, 15)); //axis-title
    theme.setRegularFont(new Font(fontName, Font.PLAIN, 11));
    theme.setRangeGridlinePaint(Color.decode("#C0C0C0"));
    theme.setPlotBackgroundPaint(Color.white);
    theme.setChartBackgroundPaint(Color.white);
    theme.setGridBandPaint(Color.red);
    theme.setAxisOffset(new RectangleInsets(0, 0, 0, 0));
    theme.setBarPainter(new StandardBarPainter());
    theme.setAxisLabelPaint(Color.decode("#666666"));
    theme.apply(chart);
    chart.setTextAntiAlias(true);
    chart.setAntiAlias(true);
}