public abstract class ChartPlugin 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
registerInputEventHandler(EventType, EventHandler) method.
| Type | Property and Description |
|---|---|
BooleanProperty |
addButtonsToToolBar
When
true the corresponding control buttons are added to the chart tool bar |
ObjectProperty<Chart> |
chart
The associated
Chart. |
| Modifier | Constructor and Description |
|---|---|
protected |
ChartPlugin()
Creates a new instance of the ChartPlugin.
|
| Modifier and Type | Method and Description |
|---|---|
BooleanProperty |
addButtonsToToolBarProperty()
When
true the corresponding control buttons are added to the chart tool bar |
ObjectProperty<Chart> |
chartProperty()
The associated
Chart. |
Chart |
getChart()
Returns the value of the
chartProperty(). |
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.
|
protected Point2D |
getLocationInPlotArea(MouseEvent event)
Converts mouse location within the scene to the location relative to the plot area.
|
boolean |
isAddButtonsToToolBar()
Returns the value of the
addButtonsToToolBarProperty(). |
void |
layoutChildren()
Optional method that allows the plug-in to react in case the size of the chart that it belongs to has changed.
|
protected void |
registerInputEventHandler(EventType<? extends InputEvent> eventType,
EventHandler<? extends InputEvent> 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 |
setAddButtonsToToolBar(boolean state)
Sets the value of the
addButtonsToToolBarProperty(). |
void |
setChart(Chart chart)
Called by the
Chart when the plugin is added to it. |
protected Tuple<Number,Number> |
toDataPoint(Axis yAxis,
Point2D displayPoint)
Converts given display point within the plot area coordinates to the corresponding data point within data
coordinates.
|
protected Point2D |
toDisplayPoint(Axis yAxis,
double x,
double y)
Converts given point in data coordinates to a point in display coordinates.
|
public final BooleanProperty addButtonsToToolBarProperty
true the corresponding control buttons are added to the chart tool barpublic final ObjectProperty<Chart> chartProperty
Chart. Initialised when the plug-in is added to the Chart, set to null when
removed.public final BooleanProperty addButtonsToToolBarProperty()
true the corresponding control buttons are added to the chart tool barpublic final ObjectProperty<Chart> chartProperty()
Chart. Initialised when the plug-in is added to the Chart, set to null when
removed.public final Chart getChart()
chartProperty().nullpublic final ObservableList<Node> getChartChildren()
The method should be used by concrete implementations to add nodes that should be added to the chart area.
protected final Point2D getLocationInPlotArea(MouseEvent event)
event - mouse eventpublic final boolean isAddButtonsToToolBar()
addButtonsToToolBarProperty().true the corresponding control buttons are added to the chart tool barpublic void layoutChildren()
protected final void registerInputEventHandler(EventType<? extends InputEvent> eventType, EventHandler<? extends InputEvent> 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 chartpublic final void setAddButtonsToToolBar(boolean state)
addButtonsToToolBarProperty().state - if true the corresponding control buttons are added to the chart tool barpublic final void setChart(Chart chart)
Chart when the plugin is added to it.chart - the chart paneprotected final Tuple<Number,Number> toDataPoint(Axis yAxis, Point2D displayPoint)
yAxis - the number-based y axisdisplayPoint - the display point to be convertedprotected final Point2D toDisplayPoint(Axis yAxis, double x, double y)
yAxis - the corresponding y-axis (number axis)x - the X coordinate (can be generic non-number, ie. CategoryAxis)y - the Y coordinate on the yAxis (Number based)Copyright © 2019 GSI Helmholtzzentrum für Schwerionenforschung GmbH. All rights reserved.