public interface IsChart extends HasHandlers
Modifier and Type | Method and Description |
---|---|
<H extends EventHandler> |
addHandler(H handler,
GwtEvent.Type<H> type)
Adds this handler to the widget.
|
void |
clear()
Will clear the chart canvas.
|
void |
destroy()
Use this to destroy any chart instances that are created.
|
void |
draw()
Draws the chart
|
String |
generateLegend()
Returns an HTML string of a legend for that chart.
|
Canvas |
getCanvas()
Returns the canvas element used to draw the chart.
|
Data |
getData()
Returns the data object with all passed datasets.
|
DatasetMetaItem |
getDatasetAtEvent(ChartNativeEvent event)
Looks for the dataset that matches the event and returns that metadata.
|
DatasetMetaItem |
getDatasetMeta(int index)
Looks for the dataset that matches the current index and returns that metadata.
|
ChartOptions |
getDefaultChartOptions()
Returns the default options created based on chart type.
|
DatasetItem |
getElementAtEvent(ChartNativeEvent 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<DatasetItem> |
getElementsAtEvent(ChartNativeEvent 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. |
String |
getId()
Returns the ID of chart.
It could be considered as chart unique ID. |
Style.Cursor |
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.
|
Type |
getType()
Returns the type of chart.
|
int |
getVisibleDatasetCount()
Returns the amount of datasets which are visible
|
boolean |
isDatasetVisible(int index)
Looks for the dataset if it's visible or not, selected by index.
|
boolean |
isDestroyOnDetach()
Returns
true if the chart is configured to be destroyed on the attach of 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 |
isInitialized()
Returns
true if CHART.JS chart has been initialized, otherwise false . |
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 |
render(UpdateConfiguration config)
Triggers a redraw of all chart elements.
|
void |
reset()
Reset the chart to it's state before the initial animation.
|
void |
resize()
Use this to manually resize the canvas element.
|
void |
setDestroyOnDetach(boolean destroyOnDetach)
Sets
true if the chart is configured to be destroyed on the attach of DIV element, otherwise
false . |
void |
setDrawOnAttach(boolean drawOnAttach)
Sets
true if the chart is configured to be draw on the attach of DIV element, otherwise false . |
void |
stop()
Use this to stop any current animation loop.
|
String |
toBase64Image()
Returns a base 64 encoded string of the chart in it's current state.
|
String |
toJSON()
Returns the string JSON representation of the object.
|
void |
update()
Triggers an update of the chart.
|
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. |
void |
updateOptions()
Triggers an update of the chart.
|
void |
updateOptions(UpdateConfiguration configuration)
Triggers an update of the chart.
|
fireEvent
<H extends EventHandler> HandlerRegistration addHandler(H handler, GwtEvent.Type<H> type)
H
- the type of handler to addtype
- the event typehandler
- the handlerHandlerRegistration
used to remove the handlerConfigurationOptions getOptions()
Type getType()
String getId()
Canvas getCanvas()
void removeCanvasPreventDefault()
Style.Cursor getInitialCursor()
boolean isInitialized()
true
if CHART.JS chart has been initialized, otherwise false
.true
if CHART.JS chart has been initialized, otherwise false
.ChartNode getNode()
Data getData()
Plugins getPlugins()
ChartOptions getDefaultChartOptions()
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
. Default is true
.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 setboolean isDestroyOnDetach()
true
if the chart is configured to be destroyed on the attach of DIV element, otherwise
false
.true
if the chart is configured to be destroyed on the attach of DIV element,
otherwise false
. Default is true
.void setDestroyOnDetach(boolean destroyOnDetach)
true
if the chart is configured to be destroyed on the attach of DIV element, otherwise
false
.destroyOnDetach
- the destroyOnDetach to setvoid destroy()
void stop()
.render()
to re-animate.void clear()
void reset()
String toBase64Image()
UndefinedValues.STRING
if chart is not initialized.String generateLegend()
UndefinedValues.STRING
if chart is not initialized.void resize()
void update()
void update(UpdateConfiguration config)
config
- a config object can be provided with additional configuration for the update processvoid updateOptions()
void updateOptions(UpdateConfiguration configuration)
configuration
- a configuration object can be provided with additional configuration for the update processvoid render()
.update()
in that case.void render(UpdateConfiguration config)
.update()
in
that case. A config object can be provided with additional configuration for the render process. This is useful when
update is manually called inside an event handler and some different animation is desired.config
- a config object can be provided with additional configuration for the render processDatasetMetaItem getDatasetMeta(int index)
index
- dataset indexDatasetMetaItem getDatasetAtEvent(ChartNativeEvent event)
event
- event of chart.boolean isDatasetVisible(int index)
index
- dataset indextrue
if dataset is visible otherwise false
.int getVisibleDatasetCount()
UndefinedValues.INTEGER
.DatasetItem getElementAtEvent(ChartNativeEvent event)
event
- event of chart.List<DatasetItem> getElementsAtEvent(ChartNativeEvent event)
event
- event of chart.void draw()
String toJSON()