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

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

Introduction

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

Prototype

public double getDomainCrosshairValue() 

Source Link

Document

Returns the domain crosshair value.

Usage

From source file:de.tor.tribes.ui.views.DSWorkbenchStatsFrame.java

private void setStartAnnotation() {
    XYPlot plot = ((XYPlot) chart.getPlot());

    double x = plot.getDomainCrosshairValue();

    if (startPointer != null) {
        plot.removeDomainMarker(startPointer);
    }//w  w w . ja  v a 2 s. c om

    if (startPointer != null && startPointer.getValue() == x) {
        plot.removeDomainMarker(startPointer);
        startPointer = null;
    } else {
        if (endPointer != null) {
            if (endPointer.getValue() < x) {
                //flip start and end
                plot.removeDomainMarker(endPointer);
                startPointer = new ValueMarker(endPointer.getValue());
                startPointer.setLabel("Start");
                startPointer.setPaint(Color.green);
                plot.addDomainMarker(startPointer);
                endPointer = new ValueMarker(x);
                endPointer.setLabel("Ende");
                endPointer.setPaint(Color.red);
                plot.addDomainMarker(endPointer);
            } else {
                startPointer = new ValueMarker(x);
                startPointer.setLabel("Start");
                startPointer.setPaint(Color.green);
                plot.addDomainMarker(startPointer);
            }
        } else {
            startPointer = new ValueMarker(x);
            startPointer.setLabel("Start");
            startPointer.setPaint(Color.green);
            plot.addDomainMarker(startPointer);
        }
    }

    jChartPanel.repaint();
}