Events

This section describes events exposed by this widget.

disposing

Fires when the widget is being removed.

Event Handler Argument:
e:

Object

Provides function parameters.

Object structure:
component:

Object

Provides access to the widget instance.

element:

jQuery

An HTML element of the widget.

model:

Object

Provides access to the data that is available for binding against the element. Available only in the Knockout and AngularJS approaches.

See Also
NOTE
This event fires only if the widget is removed using the remove(), empty(), or html() jQuery methods.

drawn

Fires when the widget has finished drawing itself.

Event Handler Argument:
e:

Object

Information about the event.

Object structure:
component:

Object

The widget instance.

element:

Object

The widget's container.

Cannot be used in themes.

incidentOccurred

Fires when an error or warning appears in a widget.

Event Handler Argument:
e:

Object

Information about the event.

Object structure:
component:

Object

The widget instance.

element:

Object

The widget's container.

target:

Object

Information about the occurred incident.

When implementing a handling function for this event, you can access information about the occurred incident using the target field of the function's argument. This information includes the following.

  • id
    Contains the ID of the incident. The full list of IDs can be found in the Errors and Warnings section.
  • type
    Contains the type of the incident. This field equals 'error' for errors or 'warning' for warnings.
  • args
    Contains the argument of the incident's message. The content of this field varies greatly, depending on the incident. For example, it may contain the name of the data source field that was not specified correctly, or the name of the option that was not set properly.
  • text
    Contains the text passed to the browser console. This text includes the content of the args field, if there is any.
  • widget
    Contains the name of the widget that produced the error or warning.
  • version
    Contains the currently used version of the ChartJS library.
See Also

initialized

Fires when the widget is initialized.

Event Handler Argument:
e:

Object

Provides function parameters.

Object structure:
component:

Object

Provides access to the widget instance.

element:

jQuery

An HTML element of the widget.

optionChanged

Fires after an option of the component is changed.

Event Handler Argument:
e:

Object

Provides function parameters.

Object structure:
component:

Object

Provides access to the widget instance.

name:

String

Specifies the name of the option whose value is changed.

fullName:

String

Specifies a full name of the option whose value is changed. The full name is formed by concatenating the names of the options that are presented in the hierarchy of the given option. The names are delimited by commas.

value: any

Specifies a new value for the option.

element:

jQuery

An HTML element of the widget.

model:

Object

Provides access to the data that is available for binding against the element. Available only in the Knockout and AngularJS approaches.

tooltipHidden

Fires when a bar's tooltip becomes hidden.

Event Handler Argument:
e:

Object

Information about the event.

Object structure:
component:

Object

The widget instance.

element:

Object

The widget's container.

target:

Object

The object containing the hovered bar's index.

Cannot be used in themes.

The bar's tooltip becomes invisible when a user hovers the mouse cursor over another bar or moves it outside the widget.

When a tooltip is made hidden, you can perform specific actions by handling this event. To do this, implement a handling function and assign it to the onTooltipHidden option. When implementing this function, use the object passed to it as its parameter. This object will provide you with the widget instance, its container and the object describing the hovered bar. You can use its index field to get the index of the hovered bar.

See Also

tooltipShown

Fires when a bar's tooltip appears.

Event Handler Argument:
e:

Object

Information about the event.

Object structure:
component:

Object

The widget instance.

element:

Object

The widget's container.

target:

Object

The object containing the hovered bar's index.

Cannot be used in themes.

The tooltip appears when a user hovers the mouse cursor over a bar.

When a tooltip appears, you can perform specific actions by handling this event. To do this, implement a handling function and assign it to the onTooltipShown option. When implementing this function, use the object passed to it as its parameter. This object will provide you with the widget instance, its container and the object describing the hovered bar. You can use its index field to get the index of the hovered bar.

See Also