Example usage for org.jfree.chart.plot FastXYPlot setBackgroundPaint

List of usage examples for org.jfree.chart.plot FastXYPlot setBackgroundPaint

Introduction

In this page you can find the example usage for org.jfree.chart.plot FastXYPlot setBackgroundPaint.

Prototype

public void setBackgroundPaint(Paint paint) 

Source Link

Document

Sets the background color of the plot area and sends a PlotChangeEvent to all registered listeners.

Usage

From source file:de.uniol.ui.tsv.ui.LineChartDialog.java

/**
 * @return the resulting chart object/* ww  w .j  a v  a  2  s  .  c  om*/
 */
protected JFreeChart createChart() {
    JFreeChart chart = ChartFactory.createTimeSeriesChartFast(title, xTitle, yTitle, xy, true, false, false);

    chart.setBackgroundPaint(Color.white);
    chart.getLegend().setBackgroundPaint(new Color(224, 224, 224));

    FastXYPlot plot = (FastXYPlot) chart.getPlot();
    //      plot.setBackgroundPaint(new Color(224, 224, 224));
    plot.setBackgroundPaint(new Color(77, 77, 77));
    plot.setDomainGridlinePaint(Color.lightGray);
    plot.setRangeGridlinePaint(Color.lightGray);
    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
    StandardXYItemRendererFast r = new StandardXYItemRendererFast(StandardXYItemRendererFast.LINES, null, null);
    plot.setRenderer(r);

    for (int i : seriesStrokes.keySet()) {
        r.setSeriesStroke(i, seriesStrokes.get(i));
    }
    for (int i : seriesColors.keySet()) {
        r.setSeriesPaint(i, seriesColors.get(i));
    }

    DateAxis da = new DateAxis(xTitle);
    if (useRelativeHourFormat) {
        da.setDateFormatOverride(new RelativeHourFormat());
    }
    da.setLowerMargin(0.03);
    plot.setDomainAxis(da);

    if (minRange != 0.0 && maxRange != 0.0) {
        ValueAxis yaxis = plot.getRangeAxis();
        yaxis.setRange(new Range(minRange, maxRange));
    }

    return chart;
}