org.jfree.chart.fx.interaction.ChartMouseEventFX Java Examples

The following examples show how to use org.jfree.chart.fx.interaction.ChartMouseEventFX. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CrosshairOverlayFXDemo1.java    From jfree-fxdemos with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public void chartMouseMoved(ChartMouseEventFX event) {
    Rectangle2D dataArea = this.chartViewer.getCanvas().getRenderingInfo().getPlotInfo().getDataArea();
    JFreeChart chart = event.getChart();
    XYPlot plot = (XYPlot) chart.getPlot();
    ValueAxis xAxis = plot.getDomainAxis();
    double x = xAxis.java2DToValue(event.getTrigger().getX(), dataArea, 
            RectangleEdge.BOTTOM);
    // make the crosshairs disappear if the mouse is out of range
    if (!xAxis.getRange().contains(x)) { 
        x = Double.NaN;                  
    }
    double y = DatasetUtils.findYValue(plot.getDataset(), 0, x);
    this.xCrosshair.setValue(x);
    this.yCrosshair.setValue(y);
}
 
Example #2
Source File: ChartCanvas.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
public void dispatchMouseClickedEvent(Point2D point, MouseEvent e) {
    double x = point.getX();
    double y = point.getY();
    ChartEntity entity = this.info.getEntityCollection().getEntity(x, y);
    ChartMouseEventFX event = new ChartMouseEventFX(this.chart, e, entity);
    for (ChartMouseListenerFX listener : this.chartMouseListeners) {
        listener.chartMouseClicked(event);
    }
}
 
Example #3
Source File: ChartCanvas.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
public void dispatchMouseMovedEvent(Point2D point, MouseEvent e) {
    double x = point.getX();
    double y = point.getY();
    ChartEntity entity = this.info.getEntityCollection().getEntity(x, y);
    ChartMouseEventFX event = new ChartMouseEventFX(this.chart, e, entity);
    for (ChartMouseListenerFX listener : this.chartMouseListeners) {
        listener.chartMouseMoved(event);
    }
}
 
Example #4
Source File: ChartViewer.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
@Override
public void chartMouseClicked(ChartMouseEventFX event) {
    // relay the event from the canvas to our registered listeners
    for (ChartMouseListenerFX listener: this.chartMouseListeners) {
        listener.chartMouseClicked(event);
    }
}
 
Example #5
Source File: ChartViewer.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
@Override
public void chartMouseMoved(ChartMouseEventFX event) {
    // relay the event from the canvas to our registered listeners
    for (ChartMouseListenerFX listener: this.chartMouseListeners) {
        listener.chartMouseMoved(event);
    }
}
 
Example #6
Source File: ChartCanvas.java    From ECG-Viewer with GNU General Public License v2.0 5 votes vote down vote up
public void dispatchMouseMovedEvent(Point2D point, MouseEvent e) {
    double x = point.getX();
    double y = point.getY();
    ChartEntity entity = this.info.getEntityCollection().getEntity(x, y);
    ChartMouseEventFX event = new ChartMouseEventFX(this.chart, e, entity);
    for (ChartMouseListenerFX listener : this.chartMouseListeners) {
        listener.chartMouseMoved(event);
    }
}
 
Example #7
Source File: ChartCanvas.java    From ECG-Viewer with GNU General Public License v2.0 5 votes vote down vote up
public void dispatchMouseClickedEvent(Point2D point, MouseEvent e) {
    double x = point.getX();
    double y = point.getY();
    ChartEntity entity = this.info.getEntityCollection().getEntity(x, y);
    ChartMouseEventFX event = new ChartMouseEventFX(this.chart, e, entity);
    for (ChartMouseListenerFX listener : this.chartMouseListeners) {
        listener.chartMouseClicked(event);
    }
}
 
Example #8
Source File: ChartViewer.java    From ECG-Viewer with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void chartMouseClicked(ChartMouseEventFX event) {
    // relay the event from the canvas to our registered listeners
    for (ChartMouseListenerFX listener: this.chartMouseListeners) {
        listener.chartMouseClicked(event);
    }
}
 
Example #9
Source File: ChartViewer.java    From ECG-Viewer with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void chartMouseMoved(ChartMouseEventFX event) {
    // relay the event from the canvas to our registered listeners
    for (ChartMouseListenerFX listener: this.chartMouseListeners) {
        listener.chartMouseMoved(event);
    }
}
 
Example #10
Source File: ChartCanvas.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
public void dispatchMouseMovedEvent(Point2D point, MouseEvent e) {
    double x = point.getX();
    double y = point.getY();
    ChartEntity entity = this.info.getEntityCollection().getEntity(x, y);
    ChartMouseEventFX event = new ChartMouseEventFX(this.chart, e, entity);
    for (ChartMouseListenerFX listener : this.chartMouseListeners) {
        listener.chartMouseMoved(event);
    }
}
 
Example #11
Source File: ChartCanvas.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
public void dispatchMouseClickedEvent(Point2D point, MouseEvent e) {
    double x = point.getX();
    double y = point.getY();
    ChartEntity entity = this.info.getEntityCollection().getEntity(x, y);
    ChartMouseEventFX event = new ChartMouseEventFX(this.chart, e, entity);
    for (ChartMouseListenerFX listener : this.chartMouseListeners) {
        listener.chartMouseClicked(event);
    }
}
 
Example #12
Source File: ChartViewer.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void chartMouseClicked(ChartMouseEventFX event) {
    // relay the event from the canvas to our registered listeners
    for (ChartMouseListenerFX listener: this.chartMouseListeners) {
        listener.chartMouseClicked(event);
    }
}
 
Example #13
Source File: ChartViewer.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void chartMouseMoved(ChartMouseEventFX event) {
    // relay the event from the canvas to our registered listeners
    for (ChartMouseListenerFX listener: this.chartMouseListeners) {
        listener.chartMouseMoved(event);
    }
}
 
Example #14
Source File: ChartCanvas.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
public void dispatchMouseMovedEvent(Point2D point, MouseEvent e) {
    double x = point.getX();
    double y = point.getY();
    ChartEntity entity = this.info.getEntityCollection().getEntity(x, y);
    ChartMouseEventFX event = new ChartMouseEventFX(this.chart, e, entity);
    for (ChartMouseListenerFX listener : this.chartMouseListeners) {
        listener.chartMouseMoved(event);
    }
}
 
Example #15
Source File: ChartCanvas.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
public void dispatchMouseClickedEvent(Point2D point, MouseEvent e) {
    double x = point.getX();
    double y = point.getY();
    ChartEntity entity = this.info.getEntityCollection().getEntity(x, y);
    ChartMouseEventFX event = new ChartMouseEventFX(this.chart, e, entity);
    for (ChartMouseListenerFX listener : this.chartMouseListeners) {
        listener.chartMouseClicked(event);
    }
}
 
Example #16
Source File: ChartViewer.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void chartMouseClicked(ChartMouseEventFX event) {
    // relay the event from the canvas to our registered listeners
    for (ChartMouseListenerFX listener: this.chartMouseListeners) {
        listener.chartMouseClicked(event);
    }
}
 
Example #17
Source File: ChartViewer.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void chartMouseMoved(ChartMouseEventFX event) {
    // relay the event from the canvas to our registered listeners
    for (ChartMouseListenerFX listener: this.chartMouseListeners) {
        listener.chartMouseMoved(event);
    }
}
 
Example #18
Source File: ChartViewer.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void chartMouseMoved(ChartMouseEventFX event) {
    // relay the event from the canvas to our registered listeners
    for (ChartMouseListenerFX listener: this.chartMouseListeners) {
        listener.chartMouseMoved(event);
    }
}
 
Example #19
Source File: ChartCanvas.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
public void dispatchMouseMovedEvent(Point2D point, MouseEvent e) {
    double x = point.getX();
    double y = point.getY();
    ChartEntity entity = this.info.getEntityCollection().getEntity(x, y);
    ChartMouseEventFX event = new ChartMouseEventFX(this.chart, e, entity);
    for (ChartMouseListenerFX listener : this.chartMouseListeners) {
        listener.chartMouseMoved(event);
    }
}
 
Example #20
Source File: ChartViewer.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void chartMouseClicked(ChartMouseEventFX event) {
    // relay the event from the canvas to our registered listeners
    for (ChartMouseListenerFX listener: this.chartMouseListeners) {
        listener.chartMouseClicked(event);
    }
}
 
Example #21
Source File: ChartCanvas.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
public void dispatchMouseClickedEvent(Point2D point, MouseEvent e) {
    double x = point.getX();
    double y = point.getY();
    ChartEntity entity = this.info.getEntityCollection().getEntity(x, y);
    ChartMouseEventFX event = new ChartMouseEventFX(this.chart, e, entity);
    for (ChartMouseListenerFX listener : this.chartMouseListeners) {
        listener.chartMouseClicked(event);
    }
}
 
Example #22
Source File: ChartCanvas.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
public void dispatchMouseClickedEvent(Point2D point, MouseEvent e) {
    double x = point.getX();
    double y = point.getY();
    ChartEntity entity = this.info.getEntityCollection().getEntity(x, y);
    ChartMouseEventFX event = new ChartMouseEventFX(this.chart, e, entity);
    for (ChartMouseListenerFX listener : this.chartMouseListeners) {
        listener.chartMouseClicked(event);
    }
}
 
Example #23
Source File: ChartCanvas.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
public void dispatchMouseMovedEvent(Point2D point, MouseEvent e) {
    double x = point.getX();
    double y = point.getY();
    ChartEntity entity = this.info.getEntityCollection().getEntity(x, y);
    ChartMouseEventFX event = new ChartMouseEventFX(this.chart, e, entity);
    for (ChartMouseListenerFX listener : this.chartMouseListeners) {
        listener.chartMouseMoved(event);
    }
}
 
Example #24
Source File: ChartViewer.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void chartMouseClicked(ChartMouseEventFX event) {
    // relay the event from the canvas to our registered listeners
    for (ChartMouseListenerFX listener: this.chartMouseListeners) {
        listener.chartMouseClicked(event);
    }
}
 
Example #25
Source File: ChartViewer.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void chartMouseMoved(ChartMouseEventFX event) {
    // relay the event from the canvas to our registered listeners
    for (ChartMouseListenerFX listener: this.chartMouseListeners) {
        listener.chartMouseMoved(event);
    }
}
 
Example #26
Source File: TaDispatchHandler.java    From TAcharting with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Handles a mouse clicked event by setting the anchor point for the
 * canvas and redrawing the org.sjwimmer.tacharting.chart (the anchor point is a reference point
 * used by the org.sjwimmer.tacharting.chart to determine crosshair lines).
 *
 * @param canvas  the org.sjwimmer.tacharting.chart canvas ({@code null} not permitted).
 * @param e  the mouse event ({@code null} not permitted).
 */
@Override
public void handleMouseClicked(TaChartCanvas canvas, MouseEvent e) {
    if (this.mousePressedPoint == null) {
        return;
    }
    double x = e.getX();
    double y = e.getY();
    ChartEntity entity = canvas.getRenderingInfo().getEntityCollection().getEntity(x, y);
    ChartMouseEventFX event = new ChartMouseEventFX(canvas.getChart(), e, entity);
    for (ChartMouseListenerFX listener : canvas.getChartMouseListeners()) {
        listener.chartMouseClicked(event);
    }
}
 
Example #27
Source File: TaDispatchHandler.java    From TAcharting with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void handleMouseMoved(TaChartCanvas canvas, MouseEvent e) {
    double x = e.getX();
    double y = e.getY();
    ChartEntity entity = canvas.getRenderingInfo().getEntityCollection().getEntity(x, y);
    ChartMouseEventFX event = new ChartMouseEventFX(canvas.getChart(), e, entity);
    for (ChartMouseListenerFX listener : canvas.getChartMouseListeners()) {
        listener.chartMouseMoved(event);
    }
}
 
Example #28
Source File: CrosshairOverlayFXDemo1.java    From jfree-fxdemos with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void chartMouseClicked(ChartMouseEventFX event) {
    // ignore
}
 
Example #29
Source File: BarChartFXDemo1.java    From openstock with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Write the event to the console, just to illustrate.
 * 
 * @param event  event info. 
 */
@Override
public void chartMouseMoved(ChartMouseEventFX event) {
    System.out.println(event);
}
 
Example #30
Source File: BarChartFXDemo1.java    From buffer_bci with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Write the event to the console, just to illustrate.
 * 
 * @param event  event info. 
 */
@Override
public void chartMouseMoved(ChartMouseEventFX event) {
    System.out.println(event);
}