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.
|
static void |
checkIfConsistent(IsChart chart)
Check if chart passed as argument is not
null and its id is not null as well, and if mandatory
methods of interface will return consistent instances.If not, throw a IllegalArgumentException . |
static void |
checkIfValid(IsChart chart)
Checks if chart passed as argument is not
null and its id is not null as well.If not, throw a IllegalArgumentException . |
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.
|
Type |
getBaseType()
Returns the base type of chart that in case of
ChartType is the same of getType() otherwise, in
case the type of the chart is a ControllerType is the chart type extension if there is or null . |
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.
|
IsDefaultScaledOptions |
getDefaultChartOptions()
Returns the default options created based on chart type.
|
Element |
getElement()
Gets a handle to the object's underlying DOM element.
|
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
|
IsDefaultScaledOptions |
getWholeOptions()
Returns the default options by a chart instance, merging global, chart type global and chart options.
|
static boolean |
isAbstractChart(IsChart chart)
Returns
true if chart passed as argument is an abstract chart instance. |
static boolean |
isConsistent(IsChart chart)
Returns
true if chart passed as argument is not null and its id is not null 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 |
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 . |
static boolean |
isValid(IsChart chart)
Returns
true if chart passed as argument is not null and its id is not null as
well. |
void |
reconfigure()
Triggers an update of the chart.
|
void |
reconfigure(UpdateConfiguration configuration)
Triggers an update of the chart.
|
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. |
fireEvent
static boolean isConsistent(IsChart chart)
true
if chart passed as argument is not null
and its id is not null
as
well, and if mandatory methods of interface will return consistent instances.chart
- chart to be checkedtrue
if chart passed as argument is not null
and its id is not null
as
well, and if mandatory methods of interface will return consistent instances.static void checkIfConsistent(IsChart chart)
null
and its id is not null
as well, and if mandatory
methods of interface will return consistent instances.IllegalArgumentException
.chart
- chart to be checkedstatic boolean isValid(IsChart chart)
true
if chart passed as argument is not null
and its id is not null
as
well.chart
- chart to be checkedtrue
if chart passed as argument is not null
and its id is not null
as
wellstatic void checkIfValid(IsChart chart)
null
and its id is not null
as well.IllegalArgumentException
.chart
- chart to be checkedstatic boolean isAbstractChart(IsChart chart)
true
if chart passed as argument is an abstract chart instance.chart
- chart to be checkedtrue
if chart passed as argument is an abstract chart instance<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 handlerElement getElement()
ConfigurationOptions getOptions()
Type getType()
Type getBaseType()
ChartType
is the same of getType()
otherwise, in
case the type of the chart is a ControllerType
is the chart type extension if there is or null
.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()
IsDefaultScaledOptions getDefaultChartOptions()
IsDefaultScaledOptions getWholeOptions()
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 reconfigure()
void reconfigure(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()