Package org.pepstock.charba.client
Interface Plugin
-
- All Known Implementing Classes:
AbstractPlugin
public interface PluginThis interface is defining the extension hook for Chart.JS plugin implementation (both for inline and global plugins).
Plugins are the most efficient way to customize or change the default behavior of a chart.- Author:
- Andrea "Stock" Stocchero
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description StringgetId()Plugins must define a unique id in order to be configurable.
Returns the plugin id.default voidonAfterBuildTicks(IsChart chart, PluginScaleArgument argument)Called after scale has build its ticks.
This hook is called separately for each scale in the chart.default voidonAfterDataLimits(IsChart chart, PluginScaleArgument argument)Called after scale data limits are calculated.
This hook is called separately for each scale in the chart.default voidonAfterDatasetDraw(IsChart chart, PluginDatasetArgument item)Called after the 'chart' datasets at the given 'args.index' have been drawn (datasets are drawn in the reverse order).
Note that this hook will not be called if the datasets drawing has been previously cancelled.default voidonAfterDatasetsDraw(IsChart chart)Called after the 'chart' datasets have been drawn.
Note that this hook will not be called if the datasets drawing has been previously cancelled.default voidonAfterDatasetsUpdate(IsChart chart, PluginUpdateArgument argument)Called after the 'chart' datasets have been updated.
Note that this hook will not be called if the datasets update has been previously cancelled.default voidonAfterDatasetUpdate(IsChart chart, PluginDatasetArgument item)Called after the 'chart' datasets at the given 'args.index' has been updated.
Note that this hook will not be called if the datasets update has been previously cancelled.default voidonAfterDestroy(IsChart chart)Called after the chart has been destroyed.default voidonAfterDraw(IsChart chart)Called after the 'chart' has been drawn.
Note that this hook will not be called if the drawing has been previously cancelled.default voidonAfterEvent(IsChart chart, PluginEventArgument argument)Called after the 'event' has been consumed.
Note that this hook will not be called if the 'event' has been previously discarded.default voidonAfterInit(IsChart chart, Chart nativeChart)Called after 'chart' has been initialized and before the first update.default voidonAfterLayout(IsChart chart)Called after the 'chart' has been layed out.
Note that this hook will not be called if the layout update has been previously cancelled.default voidonAfterRender(IsChart chart)Called after the 'chart' has been fully rendered (and animation completed).
Note that this hook will not be called if the rendering has been previously cancelled.default voidonAfterTooltipDraw(IsChart chart, PluginTooltipArgument item)Called after drawing the 'tooltip'.
Note that this hook will not be called if the tooltip drawing has been previously cancelled.default voidonAfterUpdate(IsChart chart, PluginUpdateArgument argument)Called after 'chart' has been updated and before rendering.
Note that this hook will not be called if the chart update has been previously cancelled.default voidonBeforeBuildTicks(IsChart chart, PluginScaleArgument argument)Called before scale builds its ticks.
This hook is called separately for each scale in the chart.default voidonBeforeDataLimits(IsChart chart, PluginScaleArgument argument)Called before scale data limits are calculated.
This hook is called separately for each scale in the chart.default booleanonBeforeDatasetDraw(IsChart chart, PluginDatasetArgument item)Called before drawing the 'chart' dataset at the given 'args.index' (datasets are drawn in the reverse order).
If any plugin returnsfalse, the datasets drawing is cancelled until another 'render' is triggered.default booleanonBeforeDatasetsDraw(IsChart chart)Called before drawing the 'chart' datasets.default booleanonBeforeDatasetsUpdate(IsChart chart, PluginUpdateArgument argument)Called before updating the 'chart' datasets.
If any plugin returnsfalse, the datasets update is cancelled until another 'update' is triggered.default booleanonBeforeDatasetUpdate(IsChart chart, PluginDatasetArgument item)Called before updating the 'chart' dataset at the given 'args.index'.
If any plugin returnsfalse, the datasets update is cancelled until another 'update' is triggered.default voidonBeforeDestroy(IsChart chart)Called before the chart is being destroyed.default booleanonBeforeDraw(IsChart chart)Called before drawing 'chart' at every animation frame.
If any plugin returnsfalse, the frame drawing is cancelled until another 'render' is triggered.default voidonBeforeElementsUpdate(IsChart chart)Called during the update process, before any chart elements have been created.default booleanonBeforeEvent(IsChart chart, PluginEventArgument argument)Called before processing the specified 'event'.
If any plugin returnsfalse, the event will be discarded.default voidonBeforeInit(IsChart chart)Called before initializing 'chart'.default booleanonBeforeLayout(IsChart chart)Called before laying out 'chart'.
If any plugin returnsfalse, the layout update is cancelled until another 'update' is triggered.default booleanonBeforeRender(IsChart chart)Called before rendering 'chart'.default booleanonBeforeTooltipDraw(IsChart chart, PluginTooltipArgument item)Called before drawing the 'tooltip'.
If any plugin returnsfalse, the tooltip drawing is cancelled until another 'render' is triggered.default booleanonBeforeUpdate(IsChart chart, PluginUpdateArgument argument)Called before updating 'chart'.
If any plugin returnsfalse, the update is cancelled (and thus subsequent render(s)) until another 'update' is triggered.default voidonBeginDrawing(IsChart chart, boolean overridePreviousUpdate)Called before every drawing cycle, coming from initialization, updating or rendering of chart.default voidonConfigure(IsChart chart)Called before initializing configuration of 'chart'.default voidonEndDrawing(IsChart chart)Called after every drawing cycle, coming from initialization, updating or rendering of chart.default voidonInstall(IsChart chart)Called when plugin is installed for this chart instance.
This hook is also invoked for disabled plugins (options equals to false).default voidonReset(IsChart chart)Called during chart reset.default voidonResize(IsChart chart, PluginResizeArgument argument)Called after the chart as been resized.default voidonStart(IsChart chart)Called when a plugin is starting.
This happens when chart is created or plugin is enabled.default voidonStop(IsChart chart)Called when a plugin stopping.
This happens when chart is destroyed or plugin is disabled.default voidonUninstall(IsChart chart)Called after chart is destroyed on all plugins that were installed for that chart.
This hook is also invoked for disabled plugins (options equals to false).
-
-
-
Method Detail
-
getId
String getId()
Plugins must define a unique id in order to be configurable.
Returns the plugin id. A plugin id
- can not start with a dot or an underscore
- can not contain any non-URL-safe characters
- cannot contain upper-case letters
- should be something short, but also reasonably descriptive
- Returns:
- the plugin id.
-
onConfigure
default void onConfigure(IsChart chart)
Called before initializing configuration of 'chart'.- Parameters:
chart- the chart instance.
-
onBeginDrawing
default void onBeginDrawing(IsChart chart, boolean overridePreviousUpdate)
Called before every drawing cycle, coming from initialization, updating or rendering of chart.- Parameters:
chart- the chart instanceoverridePreviousUpdate- iftruethe drawing was already running.
-
onEndDrawing
default void onEndDrawing(IsChart chart)
Called after every drawing cycle, coming from initialization, updating or rendering of chart.- Parameters:
chart- the chart instance
-
onBeforeInit
default void onBeforeInit(IsChart chart)
Called before initializing 'chart'.- Parameters:
chart- the chart instance.
-
onAfterInit
default void onAfterInit(IsChart chart, Chart nativeChart)
Called after 'chart' has been initialized and before the first update.- Parameters:
chart- the chart instance.nativeChart- CHART.JS chart instance
-
onBeforeUpdate
default boolean onBeforeUpdate(IsChart chart, PluginUpdateArgument argument)
Called before updating 'chart'.
If any plugin returnsfalse, the update is cancelled (and thus subsequent render(s)) until another 'update' is triggered.- Parameters:
chart- the chart instance.argument- the argument passed for update- Returns:
falseto cancel the chart update.
-
onAfterUpdate
default void onAfterUpdate(IsChart chart, PluginUpdateArgument argument)
Called after 'chart' has been updated and before rendering.
Note that this hook will not be called if the chart update has been previously cancelled.- Parameters:
chart- the chart instance.argument- the argument passed for update
-
onBeforeElementsUpdate
default void onBeforeElementsUpdate(IsChart chart)
Called during the update process, before any chart elements have been created.- Parameters:
chart- the chart instance.
-
onBeforeLayout
default boolean onBeforeLayout(IsChart chart)
Called before laying out 'chart'.
If any plugin returnsfalse, the layout update is cancelled until another 'update' is triggered.- Parameters:
chart- the chart instance.- Returns:
falseto cancel the chart layout.
-
onAfterLayout
default void onAfterLayout(IsChart chart)
Called after the 'chart' has been layed out.
Note that this hook will not be called if the layout update has been previously cancelled.- Parameters:
chart- the chart instance.
-
onBeforeDatasetsUpdate
default boolean onBeforeDatasetsUpdate(IsChart chart, PluginUpdateArgument argument)
Called before updating the 'chart' datasets.
If any plugin returnsfalse, the datasets update is cancelled until another 'update' is triggered.- Parameters:
chart- the chart instance.argument- the argument passed for update- Returns:
falseto cancel the datasets update.
-
onAfterDatasetsUpdate
default void onAfterDatasetsUpdate(IsChart chart, PluginUpdateArgument argument)
Called after the 'chart' datasets have been updated.
Note that this hook will not be called if the datasets update has been previously cancelled.- Parameters:
chart- the chart instance.argument- the argument passed for update
-
onBeforeDatasetUpdate
default boolean onBeforeDatasetUpdate(IsChart chart, PluginDatasetArgument item)
Called before updating the 'chart' dataset at the given 'args.index'.
If any plugin returnsfalse, the datasets update is cancelled until another 'update' is triggered.- Parameters:
chart- the chart instance.item- the dataset item.- Returns:
falseto cancel the chart datasets drawing.
-
onAfterDatasetUpdate
default void onAfterDatasetUpdate(IsChart chart, PluginDatasetArgument item)
Called after the 'chart' datasets at the given 'args.index' has been updated.
Note that this hook will not be called if the datasets update has been previously cancelled.- Parameters:
chart- the chart instance.item- the dataset item.
-
onBeforeRender
default boolean onBeforeRender(IsChart chart)
Called before rendering 'chart'.
If any plugin returnsfalse, the rendering is cancelled until another 'render' is triggered.- Parameters:
chart- the chart instance.- Returns:
falseto cancel the chart rendering.
-
onAfterRender
default void onAfterRender(IsChart chart)
Called after the 'chart' has been fully rendered (and animation completed).
Note that this hook will not be called if the rendering has been previously cancelled.- Parameters:
chart- the chart instance.
-
onBeforeDraw
default boolean onBeforeDraw(IsChart chart)
Called before drawing 'chart' at every animation frame.
If any plugin returnsfalse, the frame drawing is cancelled until another 'render' is triggered.- Parameters:
chart- the chart instance.- Returns:
falseto cancel the chart drawing.
-
onAfterDraw
default void onAfterDraw(IsChart chart)
Called after the 'chart' has been drawn.
Note that this hook will not be called if the drawing has been previously cancelled.- Parameters:
chart- the chart instance.
-
onBeforeDatasetsDraw
default boolean onBeforeDatasetsDraw(IsChart chart)
Called before drawing the 'chart' datasets.
If any plugin returnsfalse, the datasets drawing is cancelled until another 'render' is triggered.- Parameters:
chart- the chart instance.- Returns:
falseto cancel the chart datasets drawing.
-
onAfterDatasetsDraw
default void onAfterDatasetsDraw(IsChart chart)
Called after the 'chart' datasets have been drawn.
Note that this hook will not be called if the datasets drawing has been previously cancelled.- Parameters:
chart- the chart instance.
-
onBeforeDatasetDraw
default boolean onBeforeDatasetDraw(IsChart chart, PluginDatasetArgument item)
Called before drawing the 'chart' dataset at the given 'args.index' (datasets are drawn in the reverse order).
If any plugin returnsfalse, the datasets drawing is cancelled until another 'render' is triggered.- Parameters:
chart- the chart instance.item- the dataset item.- Returns:
falseto cancel the chart datasets drawing.
-
onAfterDatasetDraw
default void onAfterDatasetDraw(IsChart chart, PluginDatasetArgument item)
Called after the 'chart' datasets at the given 'args.index' have been drawn (datasets are drawn in the reverse order).
Note that this hook will not be called if the datasets drawing has been previously cancelled.- Parameters:
chart- the chart instance.item- the dataset item.
-
onBeforeTooltipDraw
default boolean onBeforeTooltipDraw(IsChart chart, PluginTooltipArgument item)
Called before drawing the 'tooltip'.
If any plugin returnsfalse, the tooltip drawing is cancelled until another 'render' is triggered.- Parameters:
chart- the chart instance.item- The tooltip instance.- Returns:
falseto cancel the chart tooltip drawing.
-
onAfterTooltipDraw
default void onAfterTooltipDraw(IsChart chart, PluginTooltipArgument item)
Called after drawing the 'tooltip'.
Note that this hook will not be called if the tooltip drawing has been previously cancelled.- Parameters:
chart- the chart instance.item- The tooltip instance.
-
onBeforeEvent
default boolean onBeforeEvent(IsChart chart, PluginEventArgument argument)
Called 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.
-
onAfterEvent
default void onAfterEvent(IsChart chart, PluginEventArgument argument)
Called after the 'event' has been consumed.
Note that this hook will not be called if the 'event' has been previously discarded.- Parameters:
chart- the chart instance.argument- instance which contains event context
-
onResize
default void onResize(IsChart chart, PluginResizeArgument argument)
Called after the chart as been resized.- Parameters:
chart- the chart instance.argument- argument of method which contains the new canvas display size (eq. canvas.style width and height).
-
onReset
default void onReset(IsChart chart)
Called during chart reset.- Parameters:
chart- the chart instance.
-
onBeforeDestroy
default void onBeforeDestroy(IsChart chart)
Called before the chart is being destroyed.- Parameters:
chart- the chart instance.
-
onAfterDestroy
default void onAfterDestroy(IsChart chart)
Called after the chart has been destroyed.- Parameters:
chart- the chart instance.
-
onInstall
default void onInstall(IsChart chart)
Called when plugin is installed for this chart instance.
This hook is also invoked for disabled plugins (options equals to false).- Parameters:
chart- the chart instance.
-
onStart
default void onStart(IsChart chart)
Called when a plugin is starting.
This happens when chart is created or plugin is enabled.- Parameters:
chart- the chart instance.
-
onStop
default void onStop(IsChart chart)
Called when a plugin stopping.
This happens when chart is destroyed or plugin is disabled.- Parameters:
chart- the chart instance.
-
onUninstall
default void onUninstall(IsChart chart)
Called after chart is destroyed on all plugins that were installed for that chart.
This hook is also invoked for disabled plugins (options equals to false).- Parameters:
chart- the chart instance.
-
onBeforeDataLimits
default void onBeforeDataLimits(IsChart chart, PluginScaleArgument argument)
Called before scale data limits are calculated.
This hook is called separately for each scale in the chart.- Parameters:
chart- the chart instance.argument- argument of method which contains the scale instance.
-
onAfterDataLimits
default void onAfterDataLimits(IsChart chart, PluginScaleArgument argument)
Called after scale data limits are calculated.
This hook is called separately for each scale in the chart.- Parameters:
chart- the chart instance.argument- argument of method which contains the scale instance.
-
onBeforeBuildTicks
default void onBeforeBuildTicks(IsChart chart, PluginScaleArgument argument)
Called before scale builds its ticks.
This hook is called separately for each scale in the chart.- Parameters:
chart- the chart instance.argument- argument of method which contains the scale instance.
-
onAfterBuildTicks
default void onAfterBuildTicks(IsChart chart, PluginScaleArgument argument)
Called after scale has build its ticks.
This hook is called separately for each scale in the chart.- Parameters:
chart- the chart instance.argument- argument of method which contains the scale instance.
-
-