Class DatasetsItemsSelector
- java.lang.Object
-
- org.pepstock.charba.client.plugins.AbstractPlugin
-
- org.pepstock.charba.client.impl.plugins.DatasetsItemsSelector
-
- All Implemented Interfaces:
Plugin
public final class DatasetsItemsSelector extends AbstractPlugin
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 DatasetsItemsSelectorOptionsFactoryFACTORYThe factory to read options for pluginstatic StringIDPlugin ID "charbadatasetsitemsselector".
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcleanSelection(IsChart chart)Clears the selection on the chart.voidcleanSelection(IsChart chart, boolean fireEvent)Clears the selection on the chart and set if an event should fire on clear action.static DatasetsItemsSelectorget()Returns the singleton instance of plugin.doublegetPadding(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.voidonBeforeDestroy(IsChart chart)Called before the chart is being destroyed.booleanonBeforeEvent(IsChart chart, PluginEventArgument argument)Called before processing the specified 'event'.
If any plugin returnsfalse, the event will be discarded.voidonBeginDrawing(IsChart chart, boolean overridePreviousUpdate)Called before every drawing cycle, coming from initialization, updating or rendering of chart.voidonConfigure(IsChart chart)Called before initializing configuration of 'chart'.voidonEndDrawing(IsChart chart)Called after every drawing cycle, coming from initialization, updating or rendering of chart.voidsetSelection(IsChart chart, double from, double to)Selects an area, invoked programmatically.
Values on axis are retrieved as number (CartesianLinearAxisorCartesianLogarithmicAxis).voidsetSelection(IsChart chart, String from, String to)Selects an area, invoked programmatically.
Values on axis are retrieved as string (CartesianCategoryAxis).voidsetSelection(IsChart chart, Date from, Date to)Selects an area, invoked programmatically.
Values on axis are retrieved as date (CartesianTimeAxisorCartesianTimeSeriesAxis).-
Methods inherited from class org.pepstock.charba.client.plugins.AbstractPlugin
getId, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.pepstock.charba.client.Plugin
onAfterBuildTicks, onAfterDataLimits, onAfterDatasetDraw, onAfterDatasetsDraw, onAfterDatasetsUpdate, onAfterDatasetUpdate, onAfterDestroy, onAfterDraw, onAfterEvent, onAfterInit, onAfterLayout, onAfterRender, onAfterTooltipDraw, onAfterUpdate, onBeforeBuildTicks, onBeforeDataLimits, onBeforeDatasetDraw, onBeforeDatasetsDraw, onBeforeDatasetsUpdate, onBeforeDatasetUpdate, onBeforeDraw, onBeforeElementsUpdate, onBeforeInit, onBeforeLayout, onBeforeRender, onBeforeTooltipDraw, onBeforeUpdate, onInstall, onReset, onResize, onStart, onStop, onUninstall
-
-
-
-
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_VALUEif 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- iftruean 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 (CartesianLinearAxisorCartesianLogarithmicAxis).- 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 (CartesianTimeAxisorCartesianTimeSeriesAxis).- Parameters:
chart- chart instance to use for selectionfrom- starting axis valueto- ending axis value
-
onConfigure
public void onConfigure(IsChart chart)
Description copied from interface:PluginCalled before initializing configuration of 'chart'.- Parameters:
chart- the chart instance.
-
onBeginDrawing
public void onBeginDrawing(IsChart chart, boolean overridePreviousUpdate)
Description copied from interface:PluginCalled before every drawing cycle, coming from initialization, updating or rendering of chart.- Parameters:
chart- the chart instanceoverridePreviousUpdate- iftruethe drawing was already running.
-
onEndDrawing
public void onEndDrawing(IsChart chart)
Description copied from interface:PluginCalled after every drawing cycle, coming from initialization, updating or rendering of chart.- Parameters:
chart- the chart instance
-
onBeforeDestroy
public void onBeforeDestroy(IsChart chart)
Description copied from interface:PluginCalled before the chart is being destroyed.- Parameters:
chart- the chart instance.
-
onBeforeEvent
public boolean onBeforeEvent(IsChart chart, PluginEventArgument argument)
Description copied from interface:PluginCalled before processing the specified 'event'.
If any plugin returnsfalse, the event will be discarded.- Parameters:
chart- the chart instance.argument- instance which contains event context- Returns:
falseto discard the event.
-
-