C - type for the specific chartpublic abstract class AbstractChartWidget<C extends IsChart> extends SimplePanel implements IsChart
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabledHasWidgets.ForIsWidgetDEBUG_ID_PREFIX| Modifier | Constructor and Description |
|---|---|
protected |
AbstractChartWidget(C chart)
Creates a chart widget for GWT by chart element instance.
|
| Modifier and Type | Method and Description |
|---|---|
HandlerRegistration |
addHandler(EventHandler handler,
EventType type)
Adds this handler to the widget.
|
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, a IllegalArgumentException 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, a IllegalArgumentException will be thrown. |
void |
createAndSetTimer(ChartTimerTask task,
int interval)
Creates a
CTimer 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 chart
|
void |
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 of
ChartType is the same of IsChart.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.
|
C |
getChart()
Returns the chart instance, wrapped by this GWT widget.
|
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.
|
Plugins |
getPlugins()
Returns the plugins element to manage inline plugins.
|
CTimer |
getTimer()
Returns a
CTimer 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 visible
|
IsDefaultScaledOptions |
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 to
true and updates the chart. |
boolean |
isChartAttached()
Returns
true whether this chart is currently attached to the browser's document. |
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()
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 |
isEventHandled(EventType type)
Returns
true if there is any event handler for event type passed as argument. |
boolean |
isInitialized()
Returns
true if CHART.JS chart has been initialized, otherwise false. |
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(ActiveDatasetElement... elements)
Sets the active (hovered) elements for the chart.
|
void |
setActiveElements(List<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)
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 |
setTooltipActiveElements(ActiveDatasetElement... elements)
Sets the active tooltip elements for the chart.
|
void |
setTooltipActiveElements(List<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 to
false and updates the chart. |
void |
stop()
Use this to stop any current animation loop.
|
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. |
add, getContainerElement, getWidget, iterator, remove, setWidget, setWidgetadd, adopt, clear, doAttachChildren, doDetachChildren, orphan, removeaddAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onBrowserEvent, onDetach, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents, unsinkEventsaddStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, resolvePotentialElement, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcheckAndGetIfConsistent, checkAndGetIfValid, checkIfConsistent, checkIfValid, clear, getOptions, isAbstractChart, isConsistent, isValid, toBase64Image, toBase64Image, toBase64ImageforEach, spliteratorprotected AbstractChartWidget(C chart)
chart - chart instance to wrap by the widgetpublic final C getChart()
public final void fireEvent(Event event)
IsChartpublic final HandlerRegistration addHandler(EventHandler handler, EventType type)
IsChartaddHandler in interface IsCharthandler - the handlertype - the event typepublic int getHandlerCount(EventType type)
IsChartgetHandlerCount in interface IsCharttype - event type to use to get the amount of handlerspublic boolean isEventHandled(EventType type)
IsCharttrue if there is any event handler for event type passed as argument.isEventHandled in interface IsCharttype - event type to checktrue if there is any event handler for event type passed as argumentpublic final Div getChartElement()
IsChartgetChartElement in interface IsChartpublic final boolean isChartAttached()
IsCharttrue whether this chart is currently attached to the browser's document.isChartAttached in interface IsCharttrue whether this chart is currently attached to the browser's documentpublic final Type getType()
IsChartpublic final Type getBaseType()
IsChartChartType is the same of IsChart.getType() otherwise, in case the type of the chart is a
ControllerType is the chart type extension if there is or null.getBaseType in interface IsChartpublic final String getId()
IsChartpublic final Canvas getCanvas()
IsChartpublic final void removeCanvasPreventDefault()
IsChartremoveCanvasPreventDefault in interface IsChartpublic final CursorType getInitialCursor()
IsChartgetInitialCursor in interface IsChartpublic final boolean isInitialized()
IsCharttrue if CHART.JS chart has been initialized, otherwise false.isInitialized in interface IsCharttrue if CHART.JS chart has been initialized, otherwise false.public final ChartNode getNode()
IsChartpublic final Data getData()
IsChartpublic final Plugins getPlugins()
IsChartgetPlugins in interface IsChartpublic final IsDefaultScaledOptions getDefaultChartOptions()
IsChartgetDefaultChartOptions in interface IsChartpublic final IsDefaultScaledOptions getWholeOptions()
IsChartgetWholeOptions in interface IsChartpublic final CTimer getTimer()
IsChartCTimer instance inside chart.public final void createAndSetTimer(ChartTimerTask task, int interval)
IsChartCTimer instance inside chart.createAndSetTimer in interface IsCharttask - 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.public final boolean isDrawOnAttach()
IsCharttrue if the chart is configured to be drawn on the attach of DIV element, otherwise false.isDrawOnAttach in interface IsCharttrue if the chart is configured to be drawn on the attach of DIV element, otherwise false.public final void setDrawOnAttach(boolean drawOnAttach)
IsCharttrue if the chart is configured to be draw on the attach of DIV element, otherwise false.setDrawOnAttach in interface IsChartdrawOnAttach - the drawOnAttach to setpublic final boolean isDestroyOnDetach()
IsCharttrue if the chart is configured to be destroyed on the attach of DIV element, otherwise false.isDestroyOnDetach in interface IsCharttrue if the chart is configured to be destroyed on the attach of DIV element, otherwise false.public final void setDestroyOnDetach(boolean destroyOnDetach)
IsCharttrue if the chart is configured to be destroyed on the attach of DIV element, otherwise false.setDestroyOnDetach in interface IsChartdestroyOnDetach - the destroyOnDetach to setpublic void setActiveElements(List<ActiveDatasetElement> elements)
IsChartsetActiveElements in interface IsChartelements - list of active elementspublic void setActiveElements(ActiveDatasetElement... elements)
IsChartsetActiveElements in interface IsChartelements - array of active elementspublic void resetActiveElements()
IsChartresetActiveElements in interface IsChartpublic List<ActiveDatasetElement> getActiveElements()
IsChartgetActiveElements in interface IsChartpublic void setTooltipActiveElements(List<ActiveDatasetElement> elements)
IsChartsetTooltipActiveElements in interface IsChartelements - list of active tooltip elementspublic void setTooltipActiveElements(ActiveDatasetElement... elements)
IsChartsetTooltipActiveElements in interface IsChartelements - array of active tooltip elementspublic void resetTooltipActiveElements()
IsChartresetTooltipActiveElements in interface IsChartpublic List<ActiveDatasetElement> getTooltipActiveElements()
IsChartgetTooltipActiveElements in interface IsChartpublic final void destroy()
IsChartpublic final void stop()
IsChart.render() to re-animate.public final void reset()
IsChartpublic String toBase64Image(ImageMimeType type, double encoderOptions)
IsCharttoBase64Image in interface IsCharttype - indicating the image formatencoderOptions - between 0 and 1 indicating the image quality to use for image formats that use lossy compression.Undefined.STRING if chart is not initialized.public final void resize()
IsChartpublic void resize(int width,
int height)
IsChartpublic final void update()
IsChartpublic final void update(TransitionKey mode)
IsChartpublic final void update(UpdateConfiguration config)
IsChartpublic void reconfigure()
IsChartreconfigure in interface IsChartpublic void reconfigure(TransitionKey mode)
IsChartreconfigure in interface IsChartmode - an animation mode can be provided to indicate what should be updated and what animation configuration should be usedpublic void reconfigure(UpdateConfiguration config)
IsChartreconfigure in interface IsChartconfig - a configuration object can be provided with additional configuration for the update processpublic final void render()
IsChart.update() in that case.public final DatasetItem getDatasetItem(int index)
IsChartgetDatasetItem in interface IsChartindex - dataset indexpublic final List<DatasetReference> getDatasetAtEvent(BaseNativeEvent event)
IsChartgetDatasetAtEvent in interface IsChartevent - event of chart.public final boolean isDatasetVisible(int index)
IsChartisDatasetVisible in interface IsChartindex - dataset indextrue if dataset is visible otherwise false.public final int getVisibleDatasetCount()
IsChartgetVisibleDatasetCount in interface IsChartUndefined.INTEGER.public void setDatasetVisibility(int datasetIndex,
boolean visibility)
IsChartsetDatasetVisibility in interface IsChartdatasetIndex - dataset indexvisibility - if true enables the visibility otherwise falsepublic void toggleDataVisibility(int index)
IsCharttoggleDataVisibility in interface IsChartindex - data indexpublic boolean isDataVisible(int index)
IsChartisDataVisible in interface IsChartindex - data indextrue if the data item is visiblepublic void hide(int datasetIndex)
IsChartpublic void hide(int datasetIndex,
int dataIndex)
IsCharttrue and updates the chart.public void show(int datasetIndex)
IsChartpublic void show(int datasetIndex,
int dataIndex)
IsChartfalse and updates the chart.public final DatasetReference getElementAtEvent(BaseNativeEvent event)
IsChartgetElementAtEvent in interface IsChartevent - event of chart.public final List<DatasetReference> getElementsAtEvent(BaseNativeEvent event)
IsChartgetElementsAtEvent in interface IsChartevent - event of chart.public final void draw()
IsChartpublic final void checkDatasets(Dataset... datasets)
IsChartIllegalArgumentException will be thrown.checkDatasets in interface IsChartdatasets - list of datasets to check.public final void checkAxes(Axis... axes)
IsChartIllegalArgumentException will be thrown.