Class ChartBackgroundColor
- java.lang.Object
-
- org.pepstock.charba.client.plugins.AbstractPlugin
-
- org.pepstock.charba.client.impl.plugins.ChartBackgroundColor
-
- All Implemented Interfaces:
Plugin
public final class ChartBackgroundColor extends AbstractPlugin
A plugin implementation to set the background color, gradient or pattern of chart.
If added to defaults, without any configuration, the chart will have aDEFAULT_BACKGROUND_COLOR
background color.- Author:
- Andrea "Stock" Stocchero
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_BACKGROUND_COLOR
Default background color,HtmlColor.WHITE
.static ChartBackgroundColorOptionsFactory
FACTORY
The factory to create optionsstatic String
ID
Plugin ID "charbabackgroundcolor".
-
Constructor Summary
Constructors Constructor Description ChartBackgroundColor()
Default constructor withDEFAULT_BACKGROUND_COLOR
background color.ChartBackgroundColor(String color)
Builds the object with the default background color for all charts.ChartBackgroundColor(Gradient gradient)
Builds the object with the default gradient for all charts.ChartBackgroundColor(IsColor color)
Builds the object with the default background color for all charts.ChartBackgroundColor(Pattern pattern)
Builds the object with the default pattern for all charts.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IsColor
getColor()
Returns the color if it has been set, otherwisenull
.String
getColorAsString()
Returns the color as string if it has been set, otherwisenull
.Gradient
getGradient()
Returns the gradient if it has been set, otherwisenull
.Pattern
getPattern()
Returns the pattern if it has been set, otherwisenull
.void
onBeforeDestroy(IsChart chart)
Called before the chart is being destroyed.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.void
onEndDrawing(IsChart chart)
Called after every drawing cycle, coming from initialization, updating or rendering of chart.void
onResize(IsChart chart, PluginResizeArgument argument)
Called after the chart as been resized.-
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, onBeforeElementsUpdate, onBeforeEvent, onBeforeInit, onBeforeLayout, onBeforeRender, onBeforeTooltipDraw, onBeforeUpdate, onBeginDrawing, onConfigure, onInstall, onReset, onStart, onStop, onUninstall
-
-
-
-
Field Detail
-
ID
public static final String ID
Plugin ID "charbabackgroundcolor".- See Also:
- Constant Field Values
-
FACTORY
public static final ChartBackgroundColorOptionsFactory FACTORY
The factory to create options
-
DEFAULT_BACKGROUND_COLOR
public static final String DEFAULT_BACKGROUND_COLOR
Default background color,HtmlColor.WHITE
.
-
-
Constructor Detail
-
ChartBackgroundColor
public ChartBackgroundColor()
Default constructor withDEFAULT_BACKGROUND_COLOR
background color.
-
ChartBackgroundColor
public ChartBackgroundColor(IsColor color)
Builds the object with the default background color for all charts.- Parameters:
color
- background default color for all charts.
-
ChartBackgroundColor
public ChartBackgroundColor(String color)
Builds the object with the default background color for all charts.- Parameters:
color
- background default color for all charts.
-
ChartBackgroundColor
public ChartBackgroundColor(Gradient gradient)
Builds the object with the default gradient for all charts.- Parameters:
gradient
- background default gradient for all charts.
-
ChartBackgroundColor
public ChartBackgroundColor(Pattern pattern)
Builds the object with the default pattern for all charts.- Parameters:
pattern
- background default pattern for all charts.
-
-
Method Detail
-
getColorAsString
public String getColorAsString()
Returns the color as string if it has been set, otherwisenull
.- Returns:
- the color as string if it has been set, otherwise
null
.
-
getColor
public IsColor getColor()
Returns the color if it has been set, otherwisenull
.- Returns:
- the color if it has been set, otherwise
null
-
getGradient
public Gradient getGradient()
Returns the gradient if it has been set, otherwisenull
.- Returns:
- the gradient if it has been set, otherwise
null
-
getPattern
public Pattern getPattern()
Returns the pattern if it has been set, otherwisenull
.- Returns:
- the pattern if it has been set, otherwise
null
-
onBeforeDraw
public boolean onBeforeDraw(IsChart chart)
Description copied from interface:Plugin
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:
false
to cancel the chart drawing.
-
onEndDrawing
public void onEndDrawing(IsChart chart)
Description copied from interface:Plugin
Called after every drawing cycle, coming from initialization, updating or rendering of chart.- Parameters:
chart
- the chart instance
-
onResize
public void onResize(IsChart chart, PluginResizeArgument argument)
Description copied from interface:Plugin
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).
-
-