Example usage for org.jfree.chart.plot XYPlot getRenderer

List of usage examples for org.jfree.chart.plot XYPlot getRenderer

Introduction

In this page you can find the example usage for org.jfree.chart.plot XYPlot getRenderer.

Prototype

public XYItemRenderer getRenderer(int index) 

Source Link

Document

Returns the renderer with the specified index, or null .

Usage

From source file:be.nbb.demetra.dfm.output.ConfidenceGraph.java

@Override
protected void onColorSchemeChange() {
    highValueColour = themeSupport.getLineColor(CONFIDENCE_COLOR);
    lowValueColour = themeSupport.getPlotColor();
    updateColourDistance();//w  w  w  . ja va 2  s  . com
    XYPlot plot = chartPanel.getChart().getXYPlot();
    plot.setBackgroundPaint(themeSupport.getPlotColor());
    plot.setDomainGridlinePaint(themeSupport.getGridColor());
    plot.setRangeGridlinePaint(themeSupport.getGridColor());
    chartPanel.getChart().setBackgroundPaint(themeSupport.getBackColor());

    XYLineAndShapeRenderer main = (XYLineAndShapeRenderer) plot.getRenderer(MAIN_INDEX);
    main.setBasePaint(themeSupport.getLineColor(MAIN_COLOR));
    XYLineAndShapeRenderer original = (XYLineAndShapeRenderer) plot.getRenderer(ORIGINAL_DATA_INDEX);
    original.setBasePaint(themeSupport.getLineColor(ORIGINAL_DATA_COLOR));

    for (int i = 0; i < indexes.length; i++) {
        XYDifferenceRenderer confidence = ((XYDifferenceRenderer) plot.getRenderer(indexes[i]));
        Color diffArea = getCellColour(indexes[i]);
        confidence.setPositivePaint(diffArea);
        confidence.setNegativePaint(diffArea);
        confidence.setBasePaint(diffArea);
        if (i != indexes.length - 1) {
            for (int j = 1; j < intermediateValues; j++) {
                confidence = ((XYDifferenceRenderer) plot.getRenderer(indexes[i] - j));
                diffArea = getCellColour(indexes[i] - ((10 / intermediateValues) * j));
                confidence.setPositivePaint(diffArea);
                confidence.setNegativePaint(diffArea);
                confidence.setBasePaint(diffArea);
            }
        }
    }
}