public class Zoomer extends XYChartPlugin<Number,Number>
MOUSE_PRESSED
event that is accepted by
zoom-in filter
. It shows a zooming rectangle determining the zoom window once mouse
button is released.MOUSE_CLICKED
event that is accepted by
zoom-out filter
. It restores the previous ranges on both axis.MOUSE_CLICKED
event that is accepted by
zoom-origin filter
. It restores the initial ranges on both axis as it was at the
moment of the first zoom-in operation.Zoomer
works properly only if both X and Y axis are instances of NumericAxis
.
CSS class name of the zoom rectangle: "chart-zoom-rect".
Type | Property and Description |
---|---|
BooleanProperty |
animated
When
true zooming will be animated. |
ObjectProperty<AxisMode> |
axisMode
The mode defining axis along which the zoom can be performed.
|
ObjectProperty<Cursor> |
dragCursor
Mouse cursor to be used during drag operation.
|
ObjectProperty<Duration> |
zoomDuration
Duration of the animated zoom (in and out).
|
chartPaneProperty
Modifier and Type | Field and Description |
---|---|
static Predicate<MouseEvent> |
DEFAULT_ZOOM_IN_MOUSE_FILTER
Default zoom-in mouse filter passing on left mouse button (only).
|
static Predicate<MouseEvent> |
DEFAULT_ZOOM_ORIGIN_MOUSE_FILTER
Default zoom-origin mouse filter passing on right mouse button with
control key
down . |
static Predicate<MouseEvent> |
DEFAULT_ZOOM_OUT_MOUSE_FILTER
Default zoom-out mouse filter passing on right mouse button (only).
|
static String |
STYLE_CLASS_ZOOM_RECT
Name of the CCS class of the zoom rectangle.
|
Constructor and Description |
---|
Zoomer()
Creates a new instance of Zoomer with animation disabled and with
zoomMode
initialized to AxisMode.XY . |
Zoomer(AxisMode zoomMode)
Creates a new instance of Zoomer with animation disabled.
|
Zoomer(AxisMode zoomMode,
boolean animated)
Creates a new instance of Zoomer.
|
Zoomer(boolean animated)
Creates a new instance of Zoomer with
zoomMode initialized to AxisMode.XY . |
Modifier and Type | Method and Description |
---|---|
BooleanProperty |
animatedProperty()
When
true zooming will be animated. |
ObjectProperty<AxisMode> |
axisModeProperty()
The mode defining axis along which the zoom can be performed.
|
void |
clear()
Clears the stack of zoom windows saved during zoom-in operations.
|
ObjectProperty<Cursor> |
dragCursorProperty()
Mouse cursor to be used during drag operation.
|
AxisMode |
getAxisMode()
Returns the value of the
axisModeProperty() . |
Cursor |
getDragCursor()
Returns the value of the
dragCursorProperty() |
Duration |
getZoomDuration()
Returns the value of the
zoomDurationProperty() . |
Predicate<MouseEvent> |
getZoomInMouseFilter()
Returns zoom-in mouse event filter.
|
Predicate<MouseEvent> |
getZoomOriginMouseFilter()
Returns zoom-origin mouse filter.
|
Predicate<MouseEvent> |
getZoomOutMouseFilter()
Returns zoom-out mouse filter.
|
boolean |
isAnimated()
Returns the value of the
animatedProperty() . |
void |
setAnimated(boolean value)
Sets the value of the
animatedProperty() . |
void |
setAxisMode(AxisMode mode)
Sets the value of the
axisModeProperty() . |
void |
setDragCursor(Cursor cursor)
Sets value of the
dragCursorProperty() . |
void |
setZoomDuration(Duration duration)
Sets the value of the
zoomDurationProperty() . |
void |
setZoomInMouseFilter(Predicate<MouseEvent> zoomInMouseFilter)
Sets filter on
DRAG_DETECTED events that should start zoom-in operation. |
void |
setZoomOriginMouseFilter(Predicate<MouseEvent> zoomOriginMouseFilter)
Sets filter on
MOUSE_CLICKED events that should trigger zoom-origin operation. |
void |
setZoomOutMouseFilter(Predicate<MouseEvent> zoomOutMouseFilter)
Sets filter on
MOUSE_CLICKED events that should trigger zoom-out operation. |
ObjectProperty<Duration> |
zoomDurationProperty()
Duration of the animated zoom (in and out).
|
boolean |
zoomOut()
Invokes zoom out action on chart if there was a zoom active.
|
chartPaneProperty, getChartChildren, getChartPane, getCharts, getLocationInPlotArea, layoutChildren, registerMouseEventHandler, setChartPane, toDataPoint, toDisplayPoint
public final ObjectProperty<AxisMode> axisModeProperty
AxisMode.XY
.getAxisMode()
,
setAxisMode(AxisMode)
public final ObjectProperty<Cursor> dragCursorProperty
getDragCursor()
,
setDragCursor(Cursor)
public final BooleanProperty animatedProperty
true
zooming will be animated. By default it's false
.isAnimated()
,
setAnimated(boolean)
public final ObjectProperty<Duration> zoomDurationProperty
animatedProperty()
is set to true
. By
default initialized to 500ms.getZoomDuration()
,
setZoomDuration(Duration)
public static final String STYLE_CLASS_ZOOM_RECT
public static final Predicate<MouseEvent> DEFAULT_ZOOM_IN_MOUSE_FILTER
public static final Predicate<MouseEvent> DEFAULT_ZOOM_OUT_MOUSE_FILTER
public static final Predicate<MouseEvent> DEFAULT_ZOOM_ORIGIN_MOUSE_FILTER
control key
down
.public Zoomer()
zoomMode
initialized to AxisMode.XY
.public Zoomer(AxisMode zoomMode)
zoomMode
- initial value of zoomMode
propertypublic Zoomer(boolean animated)
zoomMode
initialized to AxisMode.XY
.animated
- initial value of animated
propertypublic Predicate<MouseEvent> getZoomInMouseFilter()
setZoomInMouseFilter(Predicate)
public void setZoomInMouseFilter(Predicate<MouseEvent> zoomInMouseFilter)
DRAG_DETECTED
events that should start zoom-in operation.zoomInMouseFilter
- the filter to accept zoom-in mouse event. If null
then any DRAG_DETECTED event
will start zoom-in operation. By default it's set to DEFAULT_ZOOM_IN_MOUSE_FILTER
.getZoomInMouseFilter()
public Predicate<MouseEvent> getZoomOutMouseFilter()
setZoomOutMouseFilter(Predicate)
public void setZoomOutMouseFilter(Predicate<MouseEvent> zoomOutMouseFilter)
MOUSE_CLICKED
events that should trigger zoom-out operation.zoomOutMouseFilter
- the filter to accept zoom-out mouse event. If null
then any MOUSE_CLICKED event
will start zoom-out operation. By default it's set to DEFAULT_ZOOM_OUT_MOUSE_FILTER
.getZoomOutMouseFilter()
public Predicate<MouseEvent> getZoomOriginMouseFilter()
setZoomOriginMouseFilter(Predicate)
public void setZoomOriginMouseFilter(Predicate<MouseEvent> zoomOriginMouseFilter)
MOUSE_CLICKED
events that should trigger zoom-origin operation.zoomOriginMouseFilter
- the filter to accept zoom-origin mouse event. If null
then any MOUSE_CLICKED
event will start zoom-origin operation. By default it's set to
DEFAULT_ZOOM_ORIGIN_MOUSE_FILTER
.getZoomOriginMouseFilter()
public final ObjectProperty<AxisMode> axisModeProperty()
AxisMode.XY
.getAxisMode()
,
setAxisMode(AxisMode)
public final void setAxisMode(AxisMode mode)
axisModeProperty()
.mode
- the mode to be usedpublic final AxisMode getAxisMode()
axisModeProperty()
.public final ObjectProperty<Cursor> dragCursorProperty()
getDragCursor()
,
setDragCursor(Cursor)
public final void setDragCursor(Cursor cursor)
dragCursorProperty()
.cursor
- the cursor to be used by the pluginpublic final Cursor getDragCursor()
dragCursorProperty()
public final BooleanProperty animatedProperty()
true
zooming will be animated. By default it's false
.isAnimated()
,
setAnimated(boolean)
public final void setAnimated(boolean value)
animatedProperty()
.value
- if true
zoom will be animatedsetZoomDuration(Duration)
public final boolean isAnimated()
animatedProperty()
.true
if zoom is animated, false
otherwisegetZoomDuration()
public final ObjectProperty<Duration> zoomDurationProperty()
animatedProperty()
is set to true
. By
default initialized to 500ms.getZoomDuration()
,
setZoomDuration(Duration)
public final void setZoomDuration(Duration duration)
zoomDurationProperty()
.duration
- duration of the zoompublic final Duration getZoomDuration()
zoomDurationProperty()
.public boolean zoomOut()
public void clear()
Copyright © 2019 CERN. All rights reserved.