Class DatasetsItemsSelector
- java.lang.Object
-
- org.pepstock.charba.client.impl.plugins.DatasetsItemsSelector
-
- All Implemented Interfaces:
PluginContainer
public final class DatasetsItemsSelector extends Object
Enables the datasets items selection directly in the canvas.
It works only for line and bar chart instances and if ZoomPlugin is disable.
It will add mouser listeners to canvas.
Tooltips will be disable to avoid events conflicts.
Overrides also the events which can be caught (only click and touchstart).
It activates also the legend click handler to avoid that all datasets will be hidden.- Author:
- Andrea "Stock" Stocchero
- See Also:
AtLeastOneDatasetHandler
-
-
Field Summary
Fields Modifier and Type Field Description static DatasetsItemsSelectorOptionsFactory
FACTORY
The factory to read options for pluginstatic String
ID
Plugin ID "charbadatasetsitemsselector".
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cleanSelection(IsChart chart)
Clears the selection on the chart.void
cleanSelection(IsChart chart, boolean fireEvent)
Clears the selection on the chart and set if an event should fire on clear action.static DatasetsItemsSelector
get()
Returns the singleton instance of plugin.double
getPadding(IsChart chart)
Returns the padding height used by selection cleaner element if enabled.
This is very helpful when you have added padding for your purposes and you need to know the amount of space that the element allocated.void
loadPlugin(PluginsEnvelop<Plugin> envelop)
Loads the plugin to the envelop in order to pass it without exposing the methods.void
setSelection(IsChart chart, double from, double to)
Selects an area, invoked programmatically.
Values on axis are retrieved as number (CartesianLinearAxis
orCartesianLogarithmicAxis
).void
setSelection(IsChart chart, String from, String to)
Selects an area, invoked programmatically.
Values on axis are retrieved as string (CartesianCategoryAxis
).void
setSelection(IsChart chart, Date from, Date to)
Selects an area, invoked programmatically.
Values on axis are retrieved as date (CartesianTimeAxis
orCartesianTimeSeriesAxis
).
-
-
-
Field Detail
-
ID
public static final String ID
Plugin ID "charbadatasetsitemsselector".- See Also:
- Constant Field Values
-
FACTORY
public static final DatasetsItemsSelectorOptionsFactory FACTORY
The factory to read options for plugin
-
-
Method Detail
-
get
public static DatasetsItemsSelector get()
Returns the singleton instance of plugin.- Returns:
- the singleton instance of plugin
-
getPadding
public double getPadding(IsChart chart)
Returns the padding height used by selection cleaner element if enabled.
This is very helpful when you have added padding for your purposes and you need to know the amount of space that the element allocated.- Parameters:
chart
- chart instance- Returns:
- the padding height used by selection cleaner element or
SelectionCleaner.DEFAULT_VALUE
if disabled
-
cleanSelection
public void cleanSelection(IsChart chart)
Clears the selection on the chart. With this method, it don't fire any clear event if not selected in the plugin options.- Parameters:
chart
- chart instance to clear the selection
-
cleanSelection
public void cleanSelection(IsChart chart, boolean fireEvent)
Clears the selection on the chart and set if an event should fire on clear action.- Parameters:
chart
- chart instance to clear the selectionfireEvent
- iftrue
an event is fired otherwise not.
-
setSelection
public void setSelection(IsChart chart, String from, String to)
Selects an area, invoked programmatically.
Values on axis are retrieved as string (CartesianCategoryAxis
).- Parameters:
chart
- chart instance to use for selectionfrom
- starting axis valueto
- ending axis value
-
setSelection
public void setSelection(IsChart chart, double from, double to)
Selects an area, invoked programmatically.
Values on axis are retrieved as number (CartesianLinearAxis
orCartesianLogarithmicAxis
).- Parameters:
chart
- chart instance to use for selectionfrom
- starting axis valueto
- ending axis value
-
setSelection
public void setSelection(IsChart chart, Date from, Date to)
Selects an area, invoked programmatically.
Values on axis are retrieved as date (CartesianTimeAxis
orCartesianTimeSeriesAxis
).- Parameters:
chart
- chart instance to use for selectionfrom
- starting axis valueto
- ending axis value
-
loadPlugin
public final void loadPlugin(PluginsEnvelop<Plugin> envelop)
Description copied from interface:PluginContainer
Loads the plugin to the envelop in order to pass it without exposing the methods.- Specified by:
loadPlugin
in interfacePluginContainer
- Parameters:
envelop
- envelop where the plugin instance must be stored.
-
-