Package org.pepstock.charba.client
Class Defaults
- java.lang.Object
-
- org.pepstock.charba.client.Defaults
-
public final class Defaults extends Object
This singleton is a wrapper todefaults
object that CHART.JS (by CHART object) provides to get defaults values.- Author:
- Andrea "Stock" Stocchero
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description List<LegendLabelItem>
generateLabels(Chart chart)
Returns an unmodifiable list of legend labels for that chart with the callback provided by CHART.JS out of the box.List<LegendLabelItem>
generateLabels(IsChart chart)
Returns an unmodifiable list of legend labels for that chart with the callback provided by CHART.JS out of the box.static Defaults
get()
Singleton method to get static instance.Controllers
getControllers()
Returns the controllers.GlobalOptions
getGlobal()
Returns the global options.ChartOptions
getOptions(Type type)
Returns the default options by a chart type, by defaults of CHART.JS.
If the type is not consistent, throws an exception.GlobalPlugins
getPlugins()
Returns the global plugins manager.GlobalScale
getScale()
Returns the global scale.Scale
getScale(AxisType axisType)
Returns the global scale by axis type.void
invokeChartOnClick(ChartClickEvent event)
Invokes theonClick
chart function provided out of the box by CHART.JS.void
invokeChartOnHover(ChartHoverEvent event)
Invokes theonHover
chart function provided out of the box by CHART.JS.void
invokeLegendOnClick(LegendClickEvent event)
Invokes theonClick
legend function provided out of the box by CHART.JS.void
invokeLegendOnHover(LegendHoverEvent event)
Invokes theonHover
legend function provided out of the box by CHART.JS.void
invokeLegendOnLeave(LegendLeaveEvent event)
Invokes theonLeave
legend function provided out of the box by CHART.JS.List<String>
invokeTooltipsCallbackOnLabel(IsChart chart, TooltipItem item)
Returns the default text to render for an individual item in the tooltip.TooltipLabelColor
invokeTooltipsCallbackOnLabelColor(IsChart chart, TooltipItem item)
Returns the default colors to render for the tooltip item.TooltipLabelPointStyle
invokeTooltipsCallbackOnLabelPointStyle(IsChart chart, TooltipItem item)
Returns the default point style to render for the tooltip item.List<String>
invokeTooltipsCallbackOnTitle(IsChart chart, List<TooltipItem> items)
Returns the default text to render as the title of the tooltip.
-
-
-
Field Detail
-
ID
public static final String ID
Plugin ID "charbanativecharthandler", for an internal plugin to track native chart instances.- See Also:
- Constant Field Values
-
-
Method Detail
-
get
public static Defaults get()
Singleton method to get static instance.- Returns:
- defaults instance
-
getGlobal
public GlobalOptions getGlobal()
Returns the global options.- Returns:
- the global options.
-
getScale
public GlobalScale getScale()
Returns the global scale.- Returns:
- the global scale.
-
getScale
public Scale getScale(AxisType axisType)
Returns the global scale by axis type.- Parameters:
axisType
- the axis type to use to get defaults.- Returns:
- a global scale for that axis type.
-
getPlugins
public GlobalPlugins getPlugins()
Returns the global plugins manager.- Returns:
- the global plugins manager.
-
getControllers
public Controllers getControllers()
Returns the controllers.- Returns:
- the controllers.
-
getOptions
public ChartOptions getOptions(Type type)
Returns the default options by a chart type, by defaults of CHART.JS.
If the type is not consistent, throws an exception.- Parameters:
type
- chart type.- Returns:
- the default options or throws an exception if type is not consistent.
-
generateLabels
public List<LegendLabelItem> generateLabels(Chart chart)
Returns an unmodifiable list of legend labels for that chart with the callback provided by CHART.JS out of the box.- Parameters:
chart
- chart instance to use to get legend labels- Returns:
- an unmodifiable list of legend labels or an empty list if chart is not initialized.
-
generateLabels
public List<LegendLabelItem> generateLabels(IsChart chart)
Returns an unmodifiable list of legend labels for that chart with the callback provided by CHART.JS out of the box.- Parameters:
chart
- chart instance to use to get legend labels- Returns:
- an unmodifiable list of legend labels or an empty list if chart is not initialized.
-
invokeChartOnClick
public void invokeChartOnClick(ChartClickEvent event)
Invokes theonClick
chart function provided out of the box by CHART.JS.- Parameters:
event
- original event generated to invoke a chart click handler.
-
invokeChartOnHover
public void invokeChartOnHover(ChartHoverEvent event)
Invokes theonHover
chart function provided out of the box by CHART.JS.- Parameters:
event
- original event generated to invoke a chart hover handler.
-
invokeLegendOnClick
public void invokeLegendOnClick(LegendClickEvent event)
Invokes theonClick
legend function provided out of the box by CHART.JS.- Parameters:
event
- original event generated to invoke a legend click handler.
-
invokeLegendOnHover
public void invokeLegendOnHover(LegendHoverEvent event)
Invokes theonHover
legend function provided out of the box by CHART.JS.- Parameters:
event
- original event generated to invoke a legend hover handler.
-
invokeLegendOnLeave
public void invokeLegendOnLeave(LegendLeaveEvent event)
Invokes theonLeave
legend function provided out of the box by CHART.JS.- Parameters:
event
- original event generated to invoke a legend leave handler.
-
invokeTooltipsCallbackOnTitle
public List<String> invokeTooltipsCallbackOnTitle(IsChart chart, List<TooltipItem> items)
Returns the default text to render as the title of the tooltip.- Parameters:
chart
- chart instanceitems
- list of all tooltip items- Returns:
- a list of labels to apply to the title.
-
invokeTooltipsCallbackOnLabel
public List<String> invokeTooltipsCallbackOnLabel(IsChart chart, TooltipItem item)
Returns the default text to render for an individual item in the tooltip.- Parameters:
chart
- chart instanceitem
- tooltip item- Returns:
- labels to be applied.
-
invokeTooltipsCallbackOnLabelColor
public TooltipLabelColor invokeTooltipsCallbackOnLabelColor(IsChart chart, TooltipItem item)
Returns the default colors to render for the tooltip item.- Parameters:
chart
- chart instanceitem
- tooltip item- Returns:
- label color to be applied or
null
if arguments are not consistent
-
invokeTooltipsCallbackOnLabelPointStyle
public TooltipLabelPointStyle invokeTooltipsCallbackOnLabelPointStyle(IsChart chart, TooltipItem item)
Returns the default point style to render for the tooltip item.- Parameters:
chart
- chart instanceitem
- tooltip item- Returns:
- point style to be applied or
null
if arguments are not consistent
-
-