Package com.jbstrap.ui.components.charts
Class BaseChart<T>
java.lang.Object
com.jbstrap.ui.components.charts.BaseChart<T>
- Type Parameters:
T
- A chart típusa
- Direct Known Subclasses:
BulletChart
,SeriesBasedChart
- Since:
- 4.0
- Author:
- JBStrap
-
Field Summary
Modifier and TypeFieldDescriptionprotected boolean
Checks if the brush feature is enabled on the chart.protected ChartCanvas
Chart canvas instance containing the chart.protected static final String
Parameter name with the chart’s name.protected final TooltipType
Default tooltip type.protected Map<EventType,
List<BrowserEventHandler>> protected static final String
Parameter name with the chart’s name.protected Parameters
A class containing chart parameters.protected final com.google.common.collect.ImmutableList<TooltipType>
Supported tooltip types.protected Component<?>
Custom tooltip component added to the chart.protected TooltipType
The chart’s tooltip type.protected boolean
Checks if the zoom feature is enabled on the chart. -
Constructor Summary
ModifierConstructorDescriptionprotected
BaseChart
(String name, TooltipType defaultTooltipType, com.google.common.collect.ImmutableList<TooltipType> supportedTooltipTypes) -
Method Summary
Modifier and TypeMethodDescriptionprotected String
Generates a JSON object containing the chart settings.Gets the ChartCanvas instance that displays the chart.Gets the chart’s default tooltip type.final List<BrowserEventHandler>
getHandlers
(EventType eventType) Gets the handlers of the specified event typegetName()
Gets the chart name.com.google.common.collect.ImmutableList<TooltipType>
Gets the supported tooltip types.protected abstract void
init()
Chart initialization.protected T
Updates the chart data.protected void
Calls a JavaScript method on the chart.protected void
setParent
(ChartCanvas canvas) Sets the canvas that displays the chart.
-
Field Details
-
NAME
Parameter name with the chart’s name.- See Also:
-
DATA
Parameter name with the chart’s name.- See Also:
-
params
A class containing chart parameters. -
canvas
Chart canvas instance containing the chart. If the chart is not yet placed anywhere, the parameter value isnull
. -
supportedTooltipTypes
Supported tooltip types. -
defaultTooltipType
Default tooltip type. -
handlers
-
zoomable
protected boolean zoomableChecks if the zoom feature is enabled on the chart. -
brushable
protected boolean brushableChecks if the brush feature is enabled on the chart. -
tooltipType
The chart’s tooltip type. -
tooltipContent
Custom tooltip component added to the chart. If there is no custom tooltip component added to the chart, then rnull
.
-
-
Constructor Details
-
BaseChart
protected BaseChart(String name, TooltipType defaultTooltipType, com.google.common.collect.ImmutableList<TooltipType> supportedTooltipTypes) - Parameters:
name
- Chart name (required)defaultTooltipType
- The default tooltip typesupportedTooltipTypes
- list of souuprted tooltip types- Throws:
NullPointerException
- Thrown if the name of the chart or the parameter class isnull
IllegalArgumentException
- Thrown if there is a DataDescriptor specified for the chart, but the DataDescriptor does not contain the column specified in the parameter categoryColumnName or the parameter categoryColumnName is not specified and in the DataDescriptor there is no column by the name CATEGORY
-
-
Method Details
-
getName
Gets the chart name.- Returns:
- Chart name
-
refreshData
Updates the chart data.- Returns:
- Chart
-
runJs
Calls a JavaScript method on the chart.- Parameters:
script
- JavaScript code
-
setParent
Sets the canvas that displays the chart.- Parameters:
canvas
- Canvas instance If the chart was removed from the canvas, specifynull
.
-
getCanvas
Gets the ChartCanvas instance that displays the chart.- Returns:
- The ChartCanvas instance associated with the chart or
null
, if the chart is not associated with a canvas or has been removed from the canvas
-
init
protected abstract void init()Chart initialization. -
getDefaultTooltipType
Gets the chart’s default tooltip type.- Returns:
- The chart’s default tooltip type
-
getSupportedTooltipTypes
Gets the supported tooltip types.- Returns:
- A list containing all supported tooltip types
-
generateJSON
Generates a JSON object containing the chart settings.- Returns:
- JSON object containing the chart settings
-
getHandlers
Gets the handlers of the specified event type- Parameters:
eventType
- The event type. For a list of types, see theEventType
enum.- Returns:
- A list containing the handlers, or
null
if no applicable handlers were found.
-