public abstract class ConfigurationOptions extends Object implements ConfigurationElement, HasAnimation
charbaId
property key.Modifier | Constructor and Description |
---|---|
protected |
ConfigurationOptions(IsChart chart,
IsDefaultScaledOptions defaultValues)
Builds the object storing the chart instance and defaults options.
|
Modifier and Type | Method and Description |
---|---|
protected void |
afterAxisConfigurationUpdate(Axis axis)
Invoked after the axis options has been updated.
|
protected void |
afterConfigurationUpdate()
Invoked after the chart options has been updated.
|
protected void |
beforeAxisConfigurationUpdate(Axis axis)
Invoked before the axis options are going to be updated.
|
protected void |
beforeConfigurationUpdate()
Invoked before the chart options are going to be updated.
|
AnimationContainer |
getAnimationContainer()
Returns an animation container instance to use in the default methods of this interface.
|
double |
getAspectRatio()
Canvas aspect ratio (i.e.
|
protected Axis |
getAxisById(int id)
Returns the axis by the unique CHARBA id of scale or
null if not axis. |
IsColor |
getBackgroundColor()
Returns the default background color to use in the chart, on all objects, if not override by the specific configuration.
|
String |
getBackgroundColorAsString()
Returns the default background color to use in the chart, on all objects, if not override by the specific configuration.
|
IsColor |
getBorderColor()
Returns the default border color to use in the chart, on all objects, if not override by the specific configuration.
|
String |
getBorderColorAsString()
Returns the default border color to use in the chart, on all objects, if not override by the specific configuration.
|
IsChart |
getChart()
Returns the chart instance
|
IsColor |
getColor()
Returns the default color to use in the chart, on all objects, if not override by the specific configuration.
|
String |
getColorAsString()
Returns the default color to use in the chart, on all objects, if not override by the specific configuration.
|
protected T |
getConfiguration()
Returns the configuration element.
|
Datasets |
getDatasets()
Returns the data sets element.
|
double |
getDevicePixelRatio()
The chart's canvas will use a 1:1 pixel ratio, unless the physical display has a higher pixel ratio (e.g.
|
Elements |
getElements()
Returns the elements element.
|
Set<Event> |
getEvents()
Returns the browser events that the chart should listen to.
|
Filler |
getFiller()
Returns the filler plugin configuration.
|
Font |
getFont()
Returns the font element.
|
Hover |
getHover()
Returns the hover element.
|
Interaction |
getInteraction()
Returns the interaction element.
|
Layout |
getLayout()
Returns the layout element.
|
Legend |
getLegend()
Returns the legend element.
|
CLocale |
getLocale()
Returns the locale instance for internationalization.
|
Plugins |
getPlugins()
Returns the plugins element.
|
double |
getResizeDelay()
Returns the delay the resize update by give amount of milliseconds.
This can ease the resize process by debouncing update of the elements. |
Subtitle |
getSubtitle()
Returns the subtitle element.
|
Title |
getTitle()
Returns the title element.
|
Tooltips |
getTooltips()
Returns the tooltips element.
|
boolean |
hasAxisClickHandlers()
Returns
true if there is any axis click handler, otherwise false . |
boolean |
hasAxisEnterHandlers()
Returns
true if there is any axis enter handler, otherwise false . |
boolean |
hasAxisHoverHandlers()
Returns
true if there is any axis hover handler, otherwise false . |
boolean |
hasAxisLeaveHandlers()
Returns
true if there is any axis leave handler, otherwise false . |
boolean |
hasDatasetSelectionHandlers()
Returns
true if there is any data set selection handler, otherwise false . |
boolean |
hasSubtitleClickHandlers()
Returns
true if there is any subtitle click handler, otherwise false . |
boolean |
hasSubtitleEnterHandlers()
Returns
true if there is any subtitle enter handler, otherwise false . |
boolean |
hasSubtitleLeaveHandlers()
Returns
true if there is any subtitle leave handler, otherwise false . |
boolean |
hasTitleClickHandlers()
Returns
true if there is any title click handler, otherwise false . |
boolean |
hasTitleEnterHandlers()
Returns
true if there is any title enter handler, otherwise false . |
boolean |
hasTitleLeaveHandlers()
Returns
true if there is any title leave handler, otherwise false . |
boolean |
isDestroyOnDetach()
Returns
true if the chart is configured to be destroyed on the detach from DIV element, otherwise false . |
boolean |
isDrawOnAttach()
Returns
true if the chart is configured to be drawn on the attach of DIV element, otherwise false . |
boolean |
isMaintainAspectRatio()
Returns the the maintaining of the original canvas aspect ratio (width / height) when resizing.
|
boolean |
isResponsive()
Returns the resizing of the chart canvas when its container does.
|
void |
load(IsChart chart,
Configuration configuration)
Called to enable to load in the a configuration object the specific configuration item (by native object).
|
ChartEnvelop<NativeObject> |
loadNativeObject(ChartEnvelop<NativeObject> envelop)
Returns the native object instance inside an envelop.
It can be called only from org.pepstock.charba.client package. |
void |
loadOptions(ChartEnvelop<NativeObject> envelop)
Merges chart default options (by chart.defaults[type]), default scale options (by chart.defaults.scale) and global options (by chart.defaults.global) and chart options.
The chain of priority is: chart options chart default options (by chart.defaults[type]) default scale options (by chart.defaults.scale) global options (by chart.defaults.global) |
void |
merge(NativeObjectContainer source,
String property)
Merge a native object in the this one with a specific property name.
This is used by plugins implementation (native java script ones) when they are not using the standard way to add plugin configuration in the options of chart. |
void |
onAdd(AddHandlerEvent event)
Invoked when a new event handler is added.
|
void |
onRemove(RemoveHandlerEvent event)
Invoked when a chart event handler is removed.
|
static void |
register(IsChart chart,
org.pepstock.charba.client.configuration.IsEventProvider provider)
Adds the event provider implementation as handlers of chart.
|
void |
setAspectRatio(double ratio)
Canvas aspect ratio (i.e.
|
void |
setBackgroundColor(IsColor backgroundColor)
Sets the default background color to use in the chart, on all objects, if not override by the specific configuration.
|
void |
setBackgroundColor(String backgroundColor)
Sets the default background color to use in the chart, on all objects, if not override by the specific configuration.
|
void |
setBorderColor(IsColor borderColor)
Sets the default border color to use in the chart, on all objects, if not override by the specific configuration.
|
void |
setBorderColor(String borderColor)
Sets the default border color to use in the chart, on all objects, if not override by the specific configuration.
|
void |
setChartOptions(ChartEnvelop<NativeObject> envelop)
Sets the chart options as underlying configuration options, after the first draw of the chart.
Leveraging on proxy, this is mandatory and enables the possibility to use only the configuration options to update the chart options at runtime. |
void |
setColor(IsColor color)
Sets the default color to use in the chart, on all objects, if not override by the specific configuration.
|
void |
setColor(String color)
Sets the default color to use in the chart, on all objects, if not override by the specific configuration.
|
protected void |
setConfiguration(T configuration) |
void |
setDestroyOnDetach(boolean destroyOnDetach)
Sets
true if the chart is configured to be destroyed on the detach from DIV element, otherwise false . |
void |
setDevicePixelRatio(double ratio)
The chart's canvas will use a 1:1 pixel ratio, unless the physical display has a higher pixel ratio (e.g.
|
void |
setDrawOnAttach(boolean drawOnAttach)
Sets
true if the chart is configured to be draw on the attach of DIV element, otherwise false . |
void |
setEvents(Event... events)
Sets the browser events that the chart should listen to.
|
void |
setLocale(CLocale locale)
Sets the locale instance for internationalization.
|
void |
setMaintainAspectRatio(boolean maintainAspectRatio)
Sets the maintaining of the original canvas aspect ratio (width / height) when resizing.
|
void |
setResizeDelay(int delay)
Sets the delay the resize update by give amount of milliseconds.
This can ease the resize process by debouncing update of the elements. |
void |
setResponsive(boolean responsive)
Sets the resizing of the chart canvas when its container does.
|
String |
toJSON()
Returns the JSON representation of the object.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getAnimation, getAnimations, getTransitions, isAnimationEnabled, setAnimationEnabled
protected ConfigurationOptions(IsChart chart, IsDefaultScaledOptions defaultValues)
chart
- chart instancedefaultValues
- defaults optionspublic final void loadOptions(ChartEnvelop<NativeObject> envelop)
envelop
- the envelop for options as native optionspublic final void setChartOptions(ChartEnvelop<NativeObject> envelop)
envelop
- envelop for chart options as native optionsprotected void beforeConfigurationUpdate()
protected void afterConfigurationUpdate()
protected void beforeAxisConfigurationUpdate(Axis axis)
axis
- axis instance which is going to be updatedprotected void afterAxisConfigurationUpdate(Axis axis)
axis
- axis instance which has been updatedpublic final AnimationContainer getAnimationContainer()
HasAnimation
getAnimationContainer
in interface HasAnimation
public Hover getHover()
public Interaction getInteraction()
public Layout getLayout()
public Legend getLegend()
public Title getTitle()
public Subtitle getSubtitle()
public Tooltips getTooltips()
public Elements getElements()
public Datasets getDatasets()
public Plugins getPlugins()
public Filler getFiller()
public Font getFont()
protected Axis getAxisById(int id)
null
if not axis.id
- the unique CHARBA id of scalenull
if not axis.public void setEvents(Event... events)
events
- the browser events that the chart should listen to.public Set<Event> getEvents()
public void setLocale(CLocale locale)
locale
- the locale instancepublic CLocale getLocale()
public void setResponsive(boolean responsive)
responsive
- the resizing of the chart canvas when its container does.public boolean isResponsive()
public void setMaintainAspectRatio(boolean maintainAspectRatio)
maintainAspectRatio
- the maintaining of the original canvas aspect ratio (width / height) when resizing.public boolean isMaintainAspectRatio()
public void setAspectRatio(double ratio)
ratio
- the aspect ratio.public double getAspectRatio()
public void setResizeDelay(int delay)
delay
- the delay the resize update by give amount of millisecondspublic double getResizeDelay()
public void setDevicePixelRatio(double ratio)
ratio
- the pixel ratio.public double getDevicePixelRatio()
public boolean isDrawOnAttach()
true
if the chart is configured to be drawn on the attach of DIV element, otherwise false
.true
if the chart is configured to be drawn on the attach of DIV element, otherwise false
.public void setDrawOnAttach(boolean drawOnAttach)
true
if the chart is configured to be draw on the attach of DIV element, otherwise false
.drawOnAttach
- the drawOnAttach to setpublic boolean isDestroyOnDetach()
true
if the chart is configured to be destroyed on the detach from DIV element, otherwise false
.true
if the chart is configured to be destroyed on the detach from DIV element, otherwise false
.public void setDestroyOnDetach(boolean destroyOnDetach)
true
if the chart is configured to be destroyed on the detach from DIV element, otherwise false
.destroyOnDetach
- the destroyOnDetach to setpublic void setColor(IsColor color)
color
- color to use in the chart.public void setColor(String color)
color
- color to use in the chart.public String getColorAsString()
public IsColor getColor()
public void setBackgroundColor(IsColor backgroundColor)
backgroundColor
- background color to use in the chart.public void setBackgroundColor(String backgroundColor)
backgroundColor
- background color to use in the chart.public String getBackgroundColorAsString()
public IsColor getBackgroundColor()
public void setBorderColor(IsColor borderColor)
borderColor
- border color to use in the chart.public void setBorderColor(String borderColor)
borderColor
- border color to use in the chart.public String getBorderColorAsString()
public IsColor getBorderColor()
public final boolean hasDatasetSelectionHandlers()
true
if there is any data set selection handler, otherwise false
.true
if there is any data set selection handler, otherwise false
.public final boolean hasTitleClickHandlers()
true
if there is any title click handler, otherwise false
.true
if there is any title click handler, otherwise false
.public final boolean hasTitleEnterHandlers()
true
if there is any title enter handler, otherwise false
.true
if there is any title enter handler, otherwise false
.public final boolean hasTitleLeaveHandlers()
true
if there is any title leave handler, otherwise false
.true
if there is any title leave handler, otherwise false
.public final boolean hasSubtitleClickHandlers()
true
if there is any subtitle click handler, otherwise false
.true
if there is any subtitle click handler, otherwise false
.public final boolean hasSubtitleEnterHandlers()
true
if there is any subtitle enter handler, otherwise false
.true
if there is any subtitle enter handler, otherwise false
.public final boolean hasSubtitleLeaveHandlers()
true
if there is any subtitle leave handler, otherwise false
.true
if there is any subtitle leave handler, otherwise false
.public final boolean hasAxisClickHandlers()
true
if there is any axis click handler, otherwise false
.true
if there is any axis click handler, otherwise false
.public final boolean hasAxisHoverHandlers()
true
if there is any axis hover handler, otherwise false
.true
if there is any axis hover handler, otherwise false
.public final boolean hasAxisEnterHandlers()
true
if there is any axis enter handler, otherwise false
.true
if there is any axis enter handler, otherwise false
.public final boolean hasAxisLeaveHandlers()
true
if there is any axis leave handler, otherwise false
.true
if there is any axis leave handler, otherwise false
.public final void onAdd(AddHandlerEvent event)
AddHandlerEventHandler
event
- event to be consumedpublic final void onRemove(RemoveHandlerEvent event)
RemoveHandlerEventHandler
event
- event to be consumedpublic final void load(IsChart chart, Configuration configuration)
ConfigurationElement
load
in interface ConfigurationElement
chart
- chart instanceconfiguration
- chart configuration instancepublic static void register(IsChart chart, org.pepstock.charba.client.configuration.IsEventProvider provider)
chart
- chart instanceprovider
- event provider implmentationprotected final void setConfiguration(T configuration)
configuration
- the configuration to setprotected final T getConfiguration()
public final void merge(NativeObjectContainer source, String property)
source
- native object container to addproperty
- property namepublic final String toJSON()
public final ChartEnvelop<NativeObject> loadNativeObject(ChartEnvelop<NativeObject> envelop)
org.pepstock.charba.client
package.envelop
- envelop instance which will contain the native objectpublic final IsChart getChart()