X
- type of X valuesY
- type of Y valuespublic abstract class XYChartPlugin<X,Y> extends Object
Concrete plugin implementations may add custom nodes to the chart via getChartChildren()
which returns an
observable and modifiable list of nodes that will be added to the XYChartPane
on top of charts.
Plugins may also listen and react to events (e.g. mouse events) generated on the XYChartPane
via
registerMouseEventHandler(EventType, EventHandler)
method.
When plugin is added to the XYChartPane
, it is bound to it via chartPaneProperty()
, therefore plugin
implementations may observe it and be notified when they are added or removed from the XYChartPane
.
Type | Property and Description |
---|---|
ObjectProperty<XYChartPane<X,Y>> |
chartPane
The associated
XYChartPane . |
Modifier | Constructor and Description |
---|---|
protected |
XYChartPlugin()
Creates a new instance of the ChartPlugin.
|
Modifier and Type | Method and Description |
---|---|
ObjectProperty<XYChartPane<X,Y>> |
chartPaneProperty()
The associated
XYChartPane . |
ObservableList<Node> |
getChartChildren()
Returns a list containing nodes that should be added to the list of child nodes of the associated XYChart's plot
area children.
|
XYChartPane<X,Y> |
getChartPane()
Returns the value of the
chartPaneProperty() . |
protected List<XYChart<X,Y>> |
getCharts()
Convenience method returning a list containing the
chart pane base chart and all
overlay charts . |
protected Point2D |
getLocationInPlotArea(MouseEvent event)
Converts mouse location within the scene to the location relative to the plot area.
|
void |
layoutChildren()
Optional method that allows the plug-in to react in case the size of the
XYChartPane that it belongs to
has changed. |
protected void |
registerMouseEventHandler(EventType<MouseEvent> eventType,
EventHandler<MouseEvent> handler)
Registers event handlers that should be added to the
XYChartPane node when the plugin is added to the
pane and are removed once the plugin is removed from the pane. |
void |
setChartPane(XYChartPane<X,Y> chartPane)
Called by the
XYChartPane when the plugin is added to it. |
protected XYChart.Data<X,Y> |
toDataPoint(Axis<Y> yAxis,
Point2D displayPoint)
Converts given display point within the plot area coordinates to the corresponding data point within data
coordinates.
|
protected Point2D |
toDisplayPoint(Axis<Y> yAxis,
XYChart.Data<X,Y> dataPoint)
Converts given point in data coordinates to a point in display coordinates.
|
public final ObjectProperty<XYChartPane<X,Y>> chartPaneProperty
XYChartPane
. Initialized when the plugin is added to the ChartPane, set to null
when removed.getChartPane()
,
setChartPane(XYChartPane)
protected XYChartPlugin()
public final ObjectProperty<XYChartPane<X,Y>> chartPaneProperty()
XYChartPane
. Initialized when the plugin is added to the ChartPane, set to null
when removed.getChartPane()
,
setChartPane(XYChartPane)
public final XYChartPane<X,Y> getChartPane()
chartPaneProperty()
.null
public final void setChartPane(XYChartPane<X,Y> chartPane)
XYChartPane
when the plugin is added to it.chartPane
- the chart paneprotected final void registerMouseEventHandler(EventType<MouseEvent> eventType, EventHandler<MouseEvent> handler)
XYChartPane
node when the plugin is added to the
pane and are removed once the plugin is removed from the pane.eventType
- the event type on which the handler should be calledhandler
- the event handler to be added to the chartprotected final List<XYChart<X,Y>> getCharts()
chart pane base chart
and all
overlay charts
.public final ObservableList<Node> getChartChildren()
The method should be used by concrete implementations to add nodes that should be added to the chart area.
public void layoutChildren()
XYChartPane
that it belongs to
has changed.protected final Point2D getLocationInPlotArea(MouseEvent event)
event
- mouse eventprotected final Point2D toDisplayPoint(Axis<Y> yAxis, XYChart.Data<X,Y> dataPoint)
yAxis
- the Y axis for which conversion should be donedataPoint
- data point to be convertedprotected final XYChart.Data<X,Y> toDataPoint(Axis<Y> yAxis, Point2D displayPoint)
yAxis
- the Y axis for which conversion should be donedisplayPoint
- the display point to be convertedCopyright © 2019 CERN. All rights reserved.