Package org.pepstock.charba.client
Interface IsChart
-
- All Known Implementing Classes:
AbstractChart
,AbstractChartWidget
,BarChart
,BarChartWidget
,BubbleChart
,BubbleChartWidget
,BubbleMapChart
,BubbleMapChartWidget
,ChoroplethChart
,ChoroplethChartWidget
,DoughnutChart
,DoughnutChartWidget
,GaugeChart
,GaugeChartWidget
,HorizontalBarChart
,HorizontalBarChartWidget
,LineChart
,LineChartWidget
,MatrixChart
,MatrixChartWidget
,MeterChart
,MeterChartWidget
,PieChart
,PieChartWidget
,PolarAreaChart
,PolarAreaChartWidget
,RadarChart
,RadarChartWidget
,SankeyChart
,SankeyChartWidget
,ScatterChart
,ScatterChartWidget
,StackedAreaChart
,StackedAreaChartWidget
,StackedBarChart
,StackedBarChartWidget
,TimeSeriesBarChart
,TimeSeriesBarChartWidget
,TimeSeriesLineChart
,TimeSeriesLineChartWidget
,TreeMapChart
,TreeMapChartWidget
,VerticalLineChart
,VerticalLineChartWidget
public interface IsChart
Interface which defines a chart.- Author:
- Andrea "Stock" Stocchero
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description HandlerRegistration
addHandler(EventHandler handler, EventType type)
Adds this handler to the widget.static <T extends IsChart>
TcheckAndGetIfConsistent(T chart)
Check if chart passed as argument is notnull
and its id is notnull
as well, and if mandatory methods of interface will return consistent instances.
If not, throw aIllegalArgumentException
or returns the chart instance.static IsChart
checkAndGetIfValid(IsChart chart)
Check if chart passed as argument is notnull
and its id is notnull
as well.
If not, throw aIllegalArgumentException
or returns the chart instance.void
checkAxes(Axis... axes)
Checks if axes, requested to be stored, are an acceptable type or amount.
If a axis type or the amount of axes are not consistent for the chart, aIllegalArgumentException
will be thrown.void
checkDatasets(Dataset... datasets)
Checks if datasets, requested to be stored, are an acceptable type or amount.
If a dataset type or the amount of datasets are not consistent for the chart, aIllegalArgumentException
will be thrown.static void
checkIfConsistent(IsChart chart)
Check if chart passed as argument is notnull
and its id is notnull
as well, and if mandatory methods of interface will return consistent instances.
If not, throw aIllegalArgumentException
.static void
checkIfValid(IsChart chart)
Checks if chart passed as argument is notnull
and its id is notnull
as well.
If not, throw aIllegalArgumentException
.void
clear()
Will clear the chart canvas.void
createAndSetTimer(ChartTimerTask task, int interval)
Creates aCTimer
instance inside chart.
It can be created only once during the life cycle of the chart.void
destroy()
Use this to destroy any chart instances that are created.void
draw()
Draws the chartvoid
fireEvent(Event event)
Fires the event to the handlers.List<ActiveDatasetElement>
getActiveElements()
Returns the active (hovered) elements for the chart.Type
getBaseType()
Returns the base type of chart that in case ofChartType
is the same ofgetType()
otherwise, in case the type of the chart is aControllerType
is the chart type extension if there is ornull
.Canvas
getCanvas()
Returns the canvas element used to draw the chart.Div
getChartElement()
Gets a handle to the object's underlying DOM element.Data
getData()
Returns the data object with all passed datasets.List<DatasetReference>
getDatasetAtEvent(BaseNativeEvent event)
Looks for the dataset that matches the event.DatasetItem
getDatasetItem(int index)
Looks for the dataset that matches the current index and returns.IsDefaultScaledOptions
getDefaultChartOptions()
Returns the default options created based on chart type.DatasetReference
getElementAtEvent(BaseNativeEvent event)
Calling on your chart instance passing an argument of an event, will return the single element at the event position.
If there are multiple items within range, only the first is returned.List<DatasetReference>
getElementsAtEvent(BaseNativeEvent event)
Looks for the element under the event point, then returns all elements at the same data index.
Calling it on your chart instance passing an argument of an event, will return the point elements that are at that the same position of that event.int
getHandlerCount(EventType type)
Returns the amount of handlers for a specific event type.String
getId()
Returns the ID of chart.
It could be considered as chart unique ID.CursorType
getInitialCursor()
Returns the initial cursor of the chart.ChartNode
getNode()
Returns the chart node with runtime data.ConfigurationOptions
getOptions()
Returns the options of chart.Plugins
getPlugins()
Returns the plugins element to manage inline plugins.CTimer
getTimer()
Returns aCTimer
instance inside chart.List<ActiveDatasetElement>
getTooltipActiveElements()
Returns the active tooltip elements for the chart.Type
getType()
Returns the type of chart.int
getVisibleDatasetCount()
Returns the amount of datasets which are visibleIsDefaultScaledOptions
getWholeOptions()
Returns the default options by a chart instance, merging global, chart type global and chart options.void
hide(int datasetIndex)
Sets the visibility for the given dataset to false.
Updates the chart and animates the dataset with 'hide' mode.
This animation can be configured under the hide key in animation options.void
hide(int datasetIndex, int dataIndex)
Sets the hidden flag of that element index totrue
and updates the chart.static boolean
isAbstractChart(IsChart chart)
Returnstrue
if chart passed as argument is an abstract chart instance.boolean
isChartAttached()
Returnstrue
whether this chart is currently attached to the browser's document.static boolean
isConsistent(IsChart chart)
Returnstrue
if chart passed as argument is notnull
and its id is notnull
as well, and if mandatory methods of interface will return consistent instances.boolean
isDatasetVisible(int index)
Looks for the dataset if it's visible or not, selected by index.boolean
isDataVisible(int index)
Returns the stored visibility state of an data index for all datasets.boolean
isDestroyOnDetach()
Returnstrue
if the chart is configured to be destroyed on the attach of DIV element, otherwisefalse
.boolean
isDrawOnAttach()
Returnstrue
if the chart is configured to be drawn on the attach of DIV element, otherwisefalse
.boolean
isEventHandled(EventType type)
Returnstrue
if there is any event handler for event type passed as argument.boolean
isInitialized()
Returnstrue
if CHART.JS chart has been initialized, otherwisefalse
.static boolean
isValid(IsChart chart)
Returnstrue
if chart passed as argument is notnull
and its id is notnull
as well.void
reconfigure()
Triggers an update of the chart.
This can be safely called after updating the data object.
This will update the options, mutating the options property in place.void
reconfigure(TransitionKey mode)
Triggers an update of the chart.
This can be safely called after updating the data object.
This will update the options, mutating the options property in place.
A animation mode key can be provided for the update process using a specific animation configuration.
This is useful when update is manually called inside an event handler and some different animation is desired.void
reconfigure(UpdateConfiguration config)
Triggers an update of the chart.
This can be safely called after updating the data object.
This will update the options, mutating the options property in place.
A configuration object can be provided with additional configuration for the update process.
This is useful when update is manually called inside an event handler and some different animation is desired.void
removeCanvasPreventDefault()
Remove the registration of prevent default mouse listener from canvas.
This is necessary when you will add your mouse down listener.void
render()
Triggers a redraw of all chart elements.
Note, this does not update elements for new data.void
reset()
Reset the chart to it's state before the initial animation.void
resetActiveElements()
Resets the active (hovered) elements for the chart.void
resetTooltipActiveElements()
Resets the active tooltip elements for the chart.void
resize()
Use this to manually resize the canvas element.void
resize(int width, int height)
Use this to manually resize the canvas element.
This is run each time the canvas container is resized, but can be called this method manually if you change the size of the canvas nodes container element.void
setActiveElements(List<ActiveDatasetElement> elements)
Sets the active (hovered) elements for the chart.void
setActiveElements(ActiveDatasetElement... elements)
Sets the active (hovered) elements for the chart.void
setDatasetVisibility(int datasetIndex, boolean visibility)
Sets the visibility for a given dataset.
This can be used to build a chart legend in HTML.
During click on one of the HTML items, you can call it to change the appropriate dataset.void
setDestroyOnDetach(boolean destroyOnDetach)
Setstrue
if the chart is configured to be destroyed on the attach of DIV element, otherwisefalse
.void
setDrawOnAttach(boolean drawOnAttach)
Setstrue
if the chart is configured to be draw on the attach of DIV element, otherwisefalse
.void
setTooltipActiveElements(List<ActiveDatasetElement> elements)
Sets the active tooltip elements for the chart.void
setTooltipActiveElements(IsPoint point, List<ActiveDatasetElement> elements)
Sets the active tooltip elements for the chart.void
setTooltipActiveElements(IsPoint point, ActiveDatasetElement... elements)
Sets the active tooltip elements for the chart.void
setTooltipActiveElements(ActiveDatasetElement... elements)
Sets the active tooltip elements for the chart.void
show(int datasetIndex)
Sets the visibility for the given dataset to true.
Updates the chart and animates the dataset with 'show' mode.
This animation can be configured under the show key in animation options.void
show(int datasetIndex, int dataIndex)
Sets the hidden flag of that element index tofalse
and updates the chart.void
stop()
Use this to stop any current animation loop.default String
toBase64Image()
Returns a data-URL containing a representation of the image in the PNG format and the image quality value is 0.92.default String
toBase64Image(double encoderOptions)
Returns a data-URL containing a representation of the image in the PNG format.
The returned image is in a resolution of 96dpi.default String
toBase64Image(ImageMimeType type)
Returns a data-URL containing a representation of the image format, passed as argument.
The returned image is in a resolution of 96dpi and the image quality value is 0.92.String
toBase64Image(ImageMimeType type, double encoderOptions)
Returns a base 64 encoded string of the chart in it's current state.void
toggleDataVisibility(int index)
Toggles the visibility of an item in all datasets.
A dataset needs to explicitly support this feature for it to have an effect.
From internal chart types, doughnut / pie and polar area use this.void
update()
Triggers an update of the chart.
This can be safely called after updating the data object.
This will update all scales, legends, and then re-render the chart.void
update(TransitionKey mode)
Triggers an update of the chart.
This can be safely called after updating the data object.
This will update all scales, legends, and then re-render the chart.
A config object can be provided with additional configuration for the update process.
This is useful when update is manually called inside an event handler and some different animation is desired.void
update(UpdateConfiguration config)
Triggers an update of the chart.
This can be safely called after updating the data object.
This will update all scales, legends, and then re-render the chart.
A config object can be provided with additional configuration for the update process.
This is useful when update is manually called inside an event handler and some different animation is desired.
-
-
-
Method Detail
-
isConsistent
static boolean isConsistent(IsChart chart)
Returnstrue
if chart passed as argument is notnull
and its id is notnull
as well, and if mandatory methods of interface will return consistent instances.- Parameters:
chart
- chart to be checked- Returns:
true
if chart passed as argument is notnull
and its id is notnull
as well, and if mandatory methods of interface will return consistent instances.
-
checkIfConsistent
static void checkIfConsistent(IsChart chart)
Check if chart passed as argument is notnull
and its id is notnull
as well, and if mandatory methods of interface will return consistent instances.
If not, throw aIllegalArgumentException
.- Parameters:
chart
- chart to be checked
-
checkAndGetIfConsistent
static <T extends IsChart> T checkAndGetIfConsistent(T chart)
Check if chart passed as argument is notnull
and its id is notnull
as well, and if mandatory methods of interface will return consistent instances.
If not, throw aIllegalArgumentException
or returns the chart instance.- Type Parameters:
T
- type of the chart instance- Parameters:
chart
- chart to be checked- Returns:
- the chart instance passed as argument
-
isValid
static boolean isValid(IsChart chart)
Returnstrue
if chart passed as argument is notnull
and its id is notnull
as well.- Parameters:
chart
- chart to be checked- Returns:
true
if chart passed as argument is notnull
and its id is notnull
as well
-
checkIfValid
static void checkIfValid(IsChart chart)
Checks if chart passed as argument is notnull
and its id is notnull
as well.
If not, throw aIllegalArgumentException
.- Parameters:
chart
- chart to be checked
-
checkAndGetIfValid
static IsChart checkAndGetIfValid(IsChart chart)
Check if chart passed as argument is notnull
and its id is notnull
as well.
If not, throw aIllegalArgumentException
or returns the chart instance.- Parameters:
chart
- chart to be checked- Returns:
- the chart instance passed as argument
-
isAbstractChart
static boolean isAbstractChart(IsChart chart)
Returnstrue
if chart passed as argument is an abstract chart instance.- Parameters:
chart
- chart to be checked- Returns:
true
if chart passed as argument is an abstract chart instance
-
addHandler
HandlerRegistration addHandler(EventHandler handler, EventType type)
Adds this handler to the widget.- Parameters:
type
- the event typehandler
- the handler- Returns:
- handler registration used to remove the handler
-
fireEvent
void fireEvent(Event event)
Fires the event to the handlers.- Parameters:
event
- the event to fire
-
getHandlerCount
int getHandlerCount(EventType type)
Returns the amount of handlers for a specific event type.- Parameters:
type
- event type to use to get the amount of handlers- Returns:
- the amount of handlers for a specific event type
-
isEventHandled
boolean isEventHandled(EventType type)
Returnstrue
if there is any event handler for event type passed as argument.- Parameters:
type
- event type to check- Returns:
true
if there is any event handler for event type passed as argument
-
getChartElement
Div getChartElement()
Gets a handle to the object's underlying DOM element.- Returns:
- the object's browser element
-
isChartAttached
boolean isChartAttached()
Returnstrue
whether this chart is currently attached to the browser's document.- Returns:
true
whether this chart is currently attached to the browser's document
-
getOptions
ConfigurationOptions getOptions()
Returns the options of chart.- Returns:
- the options of chart.
-
getType
Type getType()
Returns the type of chart.- Returns:
- the type of chart.
-
getBaseType
Type getBaseType()
Returns the base type of chart that in case ofChartType
is the same ofgetType()
otherwise, in case the type of the chart is aControllerType
is the chart type extension if there is ornull
.- Returns:
- the base type of chart.
-
getId
String getId()
Returns the ID of chart.
It could be considered as chart unique ID.- Returns:
- the ID of chart
-
getCanvas
Canvas getCanvas()
Returns the canvas element used to draw the chart.- Returns:
- the canvas
-
removeCanvasPreventDefault
void removeCanvasPreventDefault()
Remove the registration of prevent default mouse listener from canvas.
This is necessary when you will add your mouse down listener.
-
getInitialCursor
CursorType getInitialCursor()
Returns the initial cursor of the chart.- Returns:
- the initial cursor of the chart.
-
isInitialized
boolean isInitialized()
Returnstrue
if CHART.JS chart has been initialized, otherwisefalse
.- Returns:
true
if CHART.JS chart has been initialized, otherwisefalse
.
-
getNode
ChartNode getNode()
Returns the chart node with runtime data.- Returns:
- the chart node.
-
getData
Data getData()
Returns the data object with all passed datasets.- Returns:
- the data configuration object
-
getPlugins
Plugins getPlugins()
Returns the plugins element to manage inline plugins.- Returns:
- the plugins configuration object
-
getDefaultChartOptions
IsDefaultScaledOptions getDefaultChartOptions()
Returns the default options created based on chart type.- Returns:
- the default options of the chart
-
getWholeOptions
IsDefaultScaledOptions getWholeOptions()
Returns the default options by a chart instance, merging global, chart type global and chart options.- Returns:
- the default options by a chart instance, merging global, chart type global and chart options
-
getTimer
CTimer getTimer()
Returns aCTimer
instance inside chart.- Returns:
- the timer instance of the chart
-
createAndSetTimer
void createAndSetTimer(ChartTimerTask task, int interval)
Creates aCTimer
instance inside chart.
It can be created only once during the life cycle of the chart.- Parameters:
task
- the task to be executed repeatedlyinterval
- the time, in milliseconds (thousands of a second), the timer should delay in between executions of the specified task.
Must be greater than 0.
-
isDrawOnAttach
boolean isDrawOnAttach()
Returnstrue
if the chart is configured to be drawn on the attach of DIV element, otherwisefalse
.- Returns:
- the drawOnAttach
true
if the chart is configured to be drawn on the attach of DIV element, otherwisefalse
.
-
setDrawOnAttach
void setDrawOnAttach(boolean drawOnAttach)
Setstrue
if the chart is configured to be draw on the attach of DIV element, otherwisefalse
.- Parameters:
drawOnAttach
- the drawOnAttach to set
-
isDestroyOnDetach
boolean isDestroyOnDetach()
Returnstrue
if the chart is configured to be destroyed on the attach of DIV element, otherwisefalse
.- Returns:
- the destroyOnDetach
true
if the chart is configured to be destroyed on the attach of DIV element, otherwisefalse
.
-
setDestroyOnDetach
void setDestroyOnDetach(boolean destroyOnDetach)
Setstrue
if the chart is configured to be destroyed on the attach of DIV element, otherwisefalse
.- Parameters:
destroyOnDetach
- the destroyOnDetach to set
-
setActiveElements
void setActiveElements(List<ActiveDatasetElement> elements)
Sets the active (hovered) elements for the chart.- Parameters:
elements
- list of active elements
-
setActiveElements
void setActiveElements(ActiveDatasetElement... elements)
Sets the active (hovered) elements for the chart.- Parameters:
elements
- array of active elements
-
resetActiveElements
void resetActiveElements()
Resets the active (hovered) elements for the chart.
-
getActiveElements
List<ActiveDatasetElement> getActiveElements()
Returns the active (hovered) elements for the chart.- Returns:
- the list of active elements
-
setTooltipActiveElements
void setTooltipActiveElements(List<ActiveDatasetElement> elements)
Sets the active tooltip elements for the chart.- Parameters:
elements
- list of active tooltip elements
-
setTooltipActiveElements
void setTooltipActiveElements(IsPoint point, List<ActiveDatasetElement> elements)
Sets the active tooltip elements for the chart.- Parameters:
point
- synthetic event position used in positioningelements
- list of active tooltip elements
-
resetTooltipActiveElements
void resetTooltipActiveElements()
Resets the active tooltip elements for the chart.
-
setTooltipActiveElements
void setTooltipActiveElements(ActiveDatasetElement... elements)
Sets the active tooltip elements for the chart.- Parameters:
elements
- array of active tooltip elements
-
setTooltipActiveElements
void setTooltipActiveElements(IsPoint point, ActiveDatasetElement... elements)
Sets the active tooltip elements for the chart.- Parameters:
point
- synthetic event position used in positioningelements
- array of active tooltip elements
-
getTooltipActiveElements
List<ActiveDatasetElement> getTooltipActiveElements()
Returns the active tooltip elements for the chart.- Returns:
- the array of active tooltip elements
-
destroy
void destroy()
Use this to destroy any chart instances that are created. This will clean up any references stored to the chart object within Chart.js, along with any associated event listeners attached by Chart.js.
-
stop
void stop()
Use this to stop any current animation loop. This will pause the chart during any current animation frame. Call.render()
to re-animate.
-
clear
void clear()
Will clear the chart canvas. Used extensively internally between animation frames.
-
reset
void reset()
Reset the chart to it's state before the initial animation. A new animation can then be triggered using update.
-
toBase64Image
default String toBase64Image()
Returns a data-URL containing a representation of the image in the PNG format and the image quality value is 0.92.- Returns:
- a data-URL containing a representation of the image in the PNG format
-
toBase64Image
default String toBase64Image(double encoderOptions)
Returns a data-URL containing a representation of the image in the PNG format.
The returned image is in a resolution of 96dpi.- Parameters:
encoderOptions
- between 0 and 1 indicating the image quality to use for image formats that use lossy compression.
If this argument is anything else, the default value for image quality is used. The default value is 0.92.- Returns:
- a data-URL containing a representation of the image in the PNG format
-
toBase64Image
default String toBase64Image(ImageMimeType type)
Returns a data-URL containing a representation of the image format, passed as argument.
The returned image is in a resolution of 96dpi and the image quality value is 0.92.- Parameters:
type
- indicating the image format- Returns:
- a data-URL containing a representation of the image format, passed as argument
-
toBase64Image
String toBase64Image(ImageMimeType type, double encoderOptions)
Returns a base 64 encoded string of the chart in it's current state.- Parameters:
type
- indicating the image formatencoderOptions
- between 0 and 1 indicating the image quality to use for image formats that use lossy compression.
If this argument is anything else, the default value for image quality is used. The default value is 0.92.- Returns:
- base 64 image or
Undefined.STRING
if chart is not initialized.
-
resize
void resize()
Use this to manually resize the canvas element. This is run each time the canvas container is resized, but can be called this method manually if you change the size of the canvas nodes container element.
-
resize
void resize(int width, int height)
Use this to manually resize the canvas element.
This is run each time the canvas container is resized, but can be called this method manually if you change the size of the canvas nodes container element.- Parameters:
width
- width size of resizeheight
- height size of resize
-
update
void update()
Triggers an update of the chart.
This can be safely called after updating the data object.
This will update all scales, legends, and then re-render the chart.
-
update
void update(TransitionKey mode)
Triggers an update of the chart.
This can be safely called after updating the data object.
This will update all scales, legends, and then re-render the chart.
A config object can be provided with additional configuration for the update process.
This is useful when update is manually called inside an event handler and some different animation is desired.- Parameters:
mode
- an animation mode can be provided to indicate what should be updated and what animation configuration should be used
-
update
void update(UpdateConfiguration config)
Triggers an update of the chart.
This can be safely called after updating the data object.
This will update all scales, legends, and then re-render the chart.
A config object can be provided with additional configuration for the update process.
This is useful when update is manually called inside an event handler and some different animation is desired.- Parameters:
config
- a config object can be provided with additional configuration for the update process
-
reconfigure
void reconfigure()
Triggers an update of the chart.
This can be safely called after updating the data object.
This will update the options, mutating the options property in place.
-
reconfigure
void reconfigure(TransitionKey mode)
Triggers an update of the chart.
This can be safely called after updating the data object.
This will update the options, mutating the options property in place.
A animation mode key can be provided for the update process using a specific animation configuration.
This is useful when update is manually called inside an event handler and some different animation is desired.- Parameters:
mode
- an animation mode can be provided to indicate what should be updated and what animation configuration should be used
-
reconfigure
void reconfigure(UpdateConfiguration config)
Triggers an update of the chart.
This can be safely called after updating the data object.
This will update the options, mutating the options property in place.
A configuration object can be provided with additional configuration for the update process.
This is useful when update is manually called inside an event handler and some different animation is desired.- Parameters:
config
- a configuration object can be provided with additional configuration for the update process
-
render
void render()
Triggers a redraw of all chart elements.
Note, this does not update elements for new data. Use.update()
in that case.
-
getDatasetItem
DatasetItem getDatasetItem(int index)
Looks for the dataset that matches the current index and returns.- Parameters:
index
- dataset index- Returns:
- dataset item.
-
getDatasetAtEvent
List<DatasetReference> getDatasetAtEvent(BaseNativeEvent event)
Looks for the dataset that matches the event.- Parameters:
event
- event of chart.- Returns:
- dataset item.
-
isDatasetVisible
boolean isDatasetVisible(int index)
Looks for the dataset if it's visible or not, selected by index.- Parameters:
index
- dataset index- Returns:
true
if dataset is visible otherwisefalse
.
-
getVisibleDatasetCount
int getVisibleDatasetCount()
Returns the amount of datasets which are visible- Returns:
- the amount of datasets which are visible. If chart is not initialized, return
Undefined.INTEGER
.
-
setDatasetVisibility
void setDatasetVisibility(int datasetIndex, boolean visibility)
Sets the visibility for a given dataset.
This can be used to build a chart legend in HTML.
During click on one of the HTML items, you can call it to change the appropriate dataset.- Parameters:
datasetIndex
- dataset indexvisibility
- iftrue
enables the visibility otherwisefalse
-
toggleDataVisibility
void toggleDataVisibility(int index)
Toggles the visibility of an item in all datasets.
A dataset needs to explicitly support this feature for it to have an effect.
From internal chart types, doughnut / pie and polar area use this.- Parameters:
index
- data index
-
isDataVisible
boolean isDataVisible(int index)
Returns the stored visibility state of an data index for all datasets.- Parameters:
index
- data index- Returns:
true
if the data item is visible
-
hide
void hide(int datasetIndex)
Sets the visibility for the given dataset to false.
Updates the chart and animates the dataset with 'hide' mode.
This animation can be configured under the hide key in animation options.- Parameters:
datasetIndex
- dataset index
-
hide
void hide(int datasetIndex, int dataIndex)
Sets the hidden flag of that element index totrue
and updates the chart.- Parameters:
datasetIndex
- dataset indexdataIndex
- data index
-
show
void show(int datasetIndex)
Sets the visibility for the given dataset to true.
Updates the chart and animates the dataset with 'show' mode.
This animation can be configured under the show key in animation options.- Parameters:
datasetIndex
- dataset index
-
show
void show(int datasetIndex, int dataIndex)
Sets the hidden flag of that element index tofalse
and updates the chart.- Parameters:
datasetIndex
- dataset indexdataIndex
- data index
-
getElementAtEvent
DatasetReference getElementAtEvent(BaseNativeEvent event)
Calling on your chart instance passing an argument of an event, will return the single element at the event position.
If there are multiple items within range, only the first is returned.- Parameters:
event
- event of chart.- Returns:
- single element at the event position or null.
-
getElementsAtEvent
List<DatasetReference> getElementsAtEvent(BaseNativeEvent event)
Looks for the element under the event point, then returns all elements at the same data index.
Calling it on your chart instance passing an argument of an event, will return the point elements that are at that the same position of that event.- Parameters:
event
- event of chart.- Returns:
- all elements at the same data index or an empty list.
-
draw
void draw()
Draws the chart
-
checkDatasets
void checkDatasets(Dataset... datasets)
Checks if datasets, requested to be stored, are an acceptable type or amount.
If a dataset type or the amount of datasets are not consistent for the chart, aIllegalArgumentException
will be thrown.- Parameters:
datasets
- list of datasets to check.
-
checkAxes
void checkAxes(Axis... axes)
Checks if axes, requested to be stored, are an acceptable type or amount.
If a axis type or the amount of axes are not consistent for the chart, aIllegalArgumentException
will be thrown.- Parameters:
axes
- list of axes to check.
-
-