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

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

Introduction

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

Prototype

public RectangleEdge getRangeAxisEdge(int index) 

Source Link

Document

Returns the edge for a range axis.

Usage

From source file:com.rapidminer.gui.new_plotter.engine.jfreechart.MultiAxesCrosshairOverlay.java

@Override
public void paintOverlay(Graphics2D g2, ChartPanel chartPanel) {
    Shape savedClip = g2.getClip();
    Rectangle2D dataArea = chartPanel.getScreenDataArea();
    g2.clip(dataArea);/*from   w ww  .  j  a va 2  s.c  o m*/
    JFreeChart chart = chartPanel.getChart();
    XYPlot plot = (XYPlot) chart.getPlot();
    ValueAxis xAxis = plot.getDomainAxis();
    RectangleEdge xAxisEdge = plot.getDomainAxisEdge();
    Iterator iterator = this.getDomainCrosshairs().iterator();
    while (iterator.hasNext()) {
        Crosshair ch = (Crosshair) iterator.next();
        if (ch.isVisible()) {
            double x = ch.getValue();
            double xx = xAxis.valueToJava2D(x, dataArea, xAxisEdge);
            if (plot.getOrientation() == PlotOrientation.VERTICAL) {
                drawVerticalCrosshair(g2, dataArea, xx, ch);
            } else {
                drawHorizontalCrosshair(g2, dataArea, xx, ch);
            }
        }
    }

    int rangeAxisIdx = 0;
    for (ArrayList<Crosshair> crosshairsForRange : rangeCrosshairs) {
        ValueAxis yAxis = plot.getRangeAxis(rangeAxisIdx);
        RectangleEdge yAxisEdge = plot.getRangeAxisEdge(rangeAxisIdx);
        iterator = crosshairsForRange.iterator();
        while (iterator.hasNext()) {
            Crosshair ch = (Crosshair) iterator.next();
            if (ch.isVisible()) {
                double y = ch.getValue();
                double yy = yAxis.valueToJava2D(y, dataArea, yAxisEdge);
                if (plot.getOrientation() == PlotOrientation.VERTICAL) {
                    drawHorizontalCrosshair(g2, dataArea, yy, ch);
                } else {
                    drawVerticalCrosshair(g2, dataArea, yy, ch);
                }
            }
        }
        g2.setClip(savedClip);
        ++rangeAxisIdx;
    }
}