C
- type for the specific chartpublic abstract class AbstractChartWidget<C extends IsChart> extends SimplePanel implements IsChart
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
HasWidgets.ForIsWidget
DEBUG_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 |
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.
|
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 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.
|
DatasetMetaItem |
getDatasetAtEvent(BaseNativeEvent 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.
|
DatasetItem |
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<DatasetItem> |
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. |
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.
|
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.
|
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 |
reconfigure()
Triggers an update of the chart.
|
void |
reconfigure(UpdateConfiguration config)
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.
|
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. |
add, getContainerElement, getWidget, iterator, remove, setWidget, setWidget
add, adopt, clear, doAttachChildren, doDetachChildren, orphan, remove
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onBrowserEvent, onDetach, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents, unsinkEvents
addStyleDependentName, 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, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
checkAndGetIfConsistent, checkIfConsistent, checkIfValid, clear, getOptions, isAbstractChart, isConsistent, isValid
forEach, spliterator
protected AbstractChartWidget(C chart)
chart
- chart instance to wrap by the widgetpublic final C getChart()
public final void fireEvent(Event event)
IsChart
public final HandlerRegistration addHandler(EventHandler handler, EventType type)
IsChart
addHandler
in interface IsChart
handler
- the handlertype
- the event typepublic final Div getChartElement()
IsChart
getChartElement
in interface IsChart
public final Type getType()
IsChart
public final Type getBaseType()
IsChart
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
.getBaseType
in interface IsChart
public final String getId()
IsChart
public final Canvas getCanvas()
IsChart
public final void removeCanvasPreventDefault()
IsChart
removeCanvasPreventDefault
in interface IsChart
public final CursorType getInitialCursor()
IsChart
getInitialCursor
in interface IsChart
public final boolean isInitialized()
IsChart
true
if CHART.JS chart has been initialized, otherwise false
.isInitialized
in interface IsChart
true
if CHART.JS chart has been initialized, otherwise false
.public final ChartNode getNode()
IsChart
public final Data getData()
IsChart
public final Plugins getPlugins()
IsChart
getPlugins
in interface IsChart
public final IsDefaultScaledOptions getDefaultChartOptions()
IsChart
getDefaultChartOptions
in interface IsChart
public final IsDefaultScaledOptions getWholeOptions()
IsChart
getWholeOptions
in interface IsChart
public final boolean isDrawOnAttach()
IsChart
true
if the chart is configured to be drawn on the attach of DIV element, otherwise false
.isDrawOnAttach
in interface IsChart
true
if the chart is configured to be drawn on the attach of DIV element, otherwise false
. Default is true
.public final void setDrawOnAttach(boolean drawOnAttach)
IsChart
true
if the chart is configured to be draw on the attach of DIV element, otherwise false
.setDrawOnAttach
in interface IsChart
drawOnAttach
- the drawOnAttach to setpublic final boolean isDestroyOnDetach()
IsChart
true
if the chart is configured to be destroyed on the attach of DIV element, otherwise false
.isDestroyOnDetach
in interface IsChart
true
if the chart is configured to be destroyed on the attach of DIV element, otherwise false
. Default is
true
.public final void setDestroyOnDetach(boolean destroyOnDetach)
IsChart
true
if the chart is configured to be destroyed on the attach of DIV element, otherwise false
.setDestroyOnDetach
in interface IsChart
destroyOnDetach
- the destroyOnDetach to setpublic final void destroy()
IsChart
public final void stop()
IsChart
.render()
to re-animate.public final void reset()
IsChart
public final String toBase64Image()
IsChart
toBase64Image
in interface IsChart
UndefinedValues.STRING
if chart is not initialized.public final String generateLegend()
IsChart
generateLegend
in interface IsChart
UndefinedValues.STRING
if chart is not initialized.public final void resize()
IsChart
public final void update()
IsChart
public final void update(UpdateConfiguration config)
IsChart
public final void reconfigure()
IsChart
reconfigure
in interface IsChart
public final void reconfigure(UpdateConfiguration config)
IsChart
reconfigure
in interface IsChart
config
- a configuration object can be provided with additional configuration for the update processpublic final void render()
IsChart
.update()
in that case.public final void render(UpdateConfiguration config)
IsChart
.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.public final DatasetMetaItem getDatasetMeta(int index)
IsChart
getDatasetMeta
in interface IsChart
index
- dataset indexpublic final DatasetMetaItem getDatasetAtEvent(BaseNativeEvent event)
IsChart
getDatasetAtEvent
in interface IsChart
event
- event of chart.public final boolean isDatasetVisible(int index)
IsChart
isDatasetVisible
in interface IsChart
index
- dataset indextrue
if dataset is visible otherwise false
.public final int getVisibleDatasetCount()
IsChart
getVisibleDatasetCount
in interface IsChart
UndefinedValues.INTEGER
.public final DatasetItem getElementAtEvent(BaseNativeEvent event)
IsChart
getElementAtEvent
in interface IsChart
event
- event of chart.public final List<DatasetItem> getElementsAtEvent(BaseNativeEvent event)
IsChart
getElementsAtEvent
in interface IsChart
event
- event of chart.