Example usage for org.jfree.chart.annotations XYBoxAnnotation XYBoxAnnotation

List of usage examples for org.jfree.chart.annotations XYBoxAnnotation XYBoxAnnotation

Introduction

In this page you can find the example usage for org.jfree.chart.annotations XYBoxAnnotation XYBoxAnnotation.

Prototype

public XYBoxAnnotation(double x0, double y0, double x1, double y1) 

Source Link

Document

Creates a new annotation (where, by default, the box is drawn with a black outline).

Usage

From source file:net.sourceforge.processdash.ui.web.reports.snippets.EstErrorScatterChart.java

@Override
public JFreeChart createChart() {
    JFreeChart chart = super.createChart();

    // set minimum/maximum bounds on the two axes
    XYPlot xyPlot = chart.getXYPlot();//w w  w. j  a  va  2 s .  com
    double cutoff = getPercentParam("cut", 100, 200, 5000);
    xyPlot.setDomainAxis(truncAxis(xyPlot.getDomainAxis(), cutoff));
    xyPlot.setRangeAxis(truncAxis(xyPlot.getRangeAxis(), cutoff));
    xyPlot.setRenderer(new TruncatedItemRenderer(xyPlot.getRenderer()));

    // add a box illustrating the target range
    if (data.numRows() > 0) {
        double box = getPercentParam("pct", 0, 50, 100);
        xyPlot.addAnnotation(new XYBoxAnnotation(-box, -box, box, box));
        xyPlot.addAnnotation(new XYLineAnnotation(-box, 0, box, 0));
        xyPlot.addAnnotation(new XYLineAnnotation(0, -box, 0, box));
    }

    return chart;
}