Example usage for org.jfree.chart.renderer.xy XYErrorRenderer getSeriesPaint

List of usage examples for org.jfree.chart.renderer.xy XYErrorRenderer getSeriesPaint

Introduction

In this page you can find the example usage for org.jfree.chart.renderer.xy XYErrorRenderer getSeriesPaint.

Prototype

public Paint getSeriesPaint(int series) 

Source Link

Document

Returns the paint used to color an item drawn by the renderer.

Usage

From source file:playground.thibautd.utils.charts.BoxAndWhiskersChart.java

private void createChart() {
    boolean legend = false;

    this.createDataSet();

    this.chart = ChartFactory.createBoxAndWhiskerChart(this.chartTitle, this.xAxisLabel, this.yAxisLabel,
            this.boxes, legend);

    XYPlot plot = this.chart.getXYPlot();
    plot.setDomainAxis(new NumberAxis(this.xAxisLabel));
    plot.getDomainAxis().configure();//w w w. jav  a 2 s  .c om

    if (plotStdDev) {
        XYErrorRenderer renderer = new XYErrorRenderer();
        // in black
        renderer.setErrorPaint(Color.BLACK);
        // only plot Y error
        renderer.setDrawXError(false);
        // do not render average (already done by the B&W)
        renderer.setBaseShapesVisible(false);
        plot.setRenderer(1, renderer);
        plot.setDataset(1, deviationBars);
        plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);
    }

    //this.addMatsimLogo();

    //try {
    //   this.addDefaultFormatting();
    //} catch (NullPointerException e) {
    //   // occurs if no legend
    //}

    //this.chart.setBackgroundPaint(Color.white);
    plot.setBackgroundPaint(Color.white);
    XYBoxAndWhiskerRenderer renderer = (XYBoxAndWhiskerRenderer) plot.getRenderer();
    //renderer.setFillBox(false);
    //renderer.setSeriesOutlinePaint(0, Color.black);
    //renderer.setSeriesPaint(0, Color.black);
    renderer.setBoxPaint(renderer.getSeriesPaint(0));
    //auto-adjust
    renderer.setBoxWidth(-1);
}