Package org.pepstock.charba.client.zoom
Class ZoomPlugin
- java.lang.Object
-
- org.pepstock.charba.client.plugins.AbstractExtensionPlugin<ZoomOptions>
-
- org.pepstock.charba.client.zoom.ZoomPlugin
-
public final class ZoomPlugin extends AbstractExtensionPlugin<ZoomOptions>
Entry point of ZOOM plugin to enable the plugin.
The ZOOM plugin is highly customizable CHART.JS plugin that is zooming data of charts.
The ZOOM plugin plugin has got a dependency with javascript utility hammer, utility used for gesture recognition.- Author:
- Andrea "Stock" Stocchero
-
-
Field Summary
Fields Modifier and Type Field Description static ZoomOptionsFactory
FACTORY
Zoom options factorystatic String
ID
Plugin ID "zoom".static TransitionKey
ZOOM_TRANSITION_MODE
Custom transition mode to update the chart by API, "zoom".
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
enable()
Inject the plugin but disables in the all charts waiting for the specific statement for each chart.static void
enable(boolean enableToAllCharts)
Inject the plugin and by the argument decides to enable the plugin to all charts or not.static void
enable(boolean enableToAllCharts, boolean enableHammerInjection)
Inject the plugin and by the argument decides to enable the plugin to all charts or not.static double
getZoomLevel(IsChart chart)
Returns the zoom level whenZoomPlugin
is activated.static boolean
isZoomedOrPanned(IsChart chart)
Returns whether the chart has been zoomed or panned, for instance whether the initial scale of any axis is different to the one used currently.static void
pan(IsChart chart, double amount)
Pans the chart on demand, programmatically.static void
pan(IsChart chart, double amount, TransitionKey transition)
Pans the chart on demand, programmatically.static void
pan(IsChart chart, Amount amount)
Pans the chart on demand, programmatically.static void
pan(IsChart chart, Amount amount, TransitionKey transition)
Pans the chart on demand, programmatically.static void
reset(IsChart chart)
Reset the zoom of chart whenZoomPlugin
is activated.static void
reset(IsChart chart, TransitionKey transition)
Reset the zoom of chart whenZoomPlugin
is activated.static void
zoom(IsChart chart, double amount)
Zooms the chart on demand, programmatically.static void
zoom(IsChart chart, double amount, TransitionKey transition)
Zooms the chart on demand, programmatically.static void
zoom(IsChart chart, Amount amount)
Zooms the chart on demand, programmatically.static void
zoom(IsChart chart, Amount amount, TransitionKey transition)
Zooms the chart on demand, programmatically.static void
zoomScale(IsChart chart, ScaleId scaleId, ScaleRange range)
Zooms the chart scale on demand, programmatically.static void
zoomScale(IsChart chart, ScaleId scaleId, ScaleRange range, TransitionKey transition)
Zooms the chart scale on demand, programmatically.-
Methods inherited from class org.pepstock.charba.client.plugins.AbstractExtensionPlugin
applyingDefaults, getDefaults, isRegistered, loadDefaults
-
-
-
-
Field Detail
-
ID
public static final String ID
Plugin ID "zoom".
-
FACTORY
public static final ZoomOptionsFactory FACTORY
Zoom options factory
-
ZOOM_TRANSITION_MODE
public static final TransitionKey ZOOM_TRANSITION_MODE
Custom transition mode to update the chart by API, "zoom".
-
-
Method Detail
-
enable
public static void enable()
Inject the plugin but disables in the all charts waiting for the specific statement for each chart.
-
enable
public static void enable(boolean enableToAllCharts)
Inject the plugin and by the argument decides to enable the plugin to all charts or not.- Parameters:
enableToAllCharts
- bytrue
the plugin will be enabled to all charts, otherwisefalse
.
-
enable
public static void enable(boolean enableToAllCharts, boolean enableHammerInjection)
Inject the plugin and by the argument decides to enable the plugin to all charts or not.- Parameters:
enableToAllCharts
- bytrue
the plugin will be enabled to all charts, otherwisefalse
.enableHammerInjection
- iffalse
, HammerJs library will not be injected
-
getZoomLevel
public static double getZoomLevel(IsChart chart)
Returns the zoom level whenZoomPlugin
is activated.- Parameters:
chart
- chart instance to invoke- Returns:
- the zoom level
-
isZoomedOrPanned
public static boolean isZoomedOrPanned(IsChart chart)
Returns whether the chart has been zoomed or panned, for instance whether the initial scale of any axis is different to the one used currently.- Parameters:
chart
- chart instance to invoke- Returns:
true
if the chart has been zoomed or panned
-
reset
public static void reset(IsChart chart)
Reset the zoom of chart whenZoomPlugin
is activated.- Parameters:
chart
- chart instance to invoke
-
reset
public static void reset(IsChart chart, TransitionKey transition)
Reset the zoom of chart whenZoomPlugin
is activated.- Parameters:
chart
- chart instance to invoketransition
- update transition mode, could benull
-
pan
public static void pan(IsChart chart, Amount amount)
Pans the chart on demand, programmatically.- Parameters:
chart
- chart instance to invokeamount
- amount of pan to apply
-
pan
public static void pan(IsChart chart, Amount amount, TransitionKey transition)
Pans the chart on demand, programmatically.- Parameters:
chart
- chart instance to invokeamount
- amount of pan to applytransition
- update transition mode
-
pan
public static void pan(IsChart chart, double amount)
Pans the chart on demand, programmatically.- Parameters:
chart
- chart instance to invokeamount
- amount of pan to apply
-
pan
public static void pan(IsChart chart, double amount, TransitionKey transition)
Pans the chart on demand, programmatically.- Parameters:
chart
- chart instance to invokeamount
- amount of pan to applytransition
- update transition mode
-
zoom
public static void zoom(IsChart chart, Amount amount)
Zooms the chart on demand, programmatically.- Parameters:
chart
- chart instance to invokeamount
- amount of zoom to apply
-
zoom
public static void zoom(IsChart chart, Amount amount, TransitionKey transition)
Zooms the chart on demand, programmatically.- Parameters:
chart
- chart instance to invokeamount
- amount of zoom to applytransition
- update transition mode
-
zoom
public static void zoom(IsChart chart, double amount)
Zooms the chart on demand, programmatically.- Parameters:
chart
- chart instance to invokeamount
- amount of zoom to apply
-
zoom
public static void zoom(IsChart chart, double amount, TransitionKey transition)
Zooms the chart on demand, programmatically.- Parameters:
chart
- chart instance to invokeamount
- amount of zoom to applytransition
- update transition mode
-
zoomScale
public static void zoomScale(IsChart chart, ScaleId scaleId, ScaleRange range)
Zooms the chart scale on demand, programmatically.- Parameters:
chart
- chart instance to invokescaleId
- scale id to zoomrange
- range (min/max) of scale to zoom
-
zoomScale
public static void zoomScale(IsChart chart, ScaleId scaleId, ScaleRange range, TransitionKey transition)
Zooms the chart scale on demand, programmatically.- Parameters:
chart
- chart instance to invokescaleId
- scale id to zoomrange
- range (min/max) of scale to zoomtransition
- update transition mode
-
-