Events

This section describes events fired by this widget.

See Also

disposing

Raised when the widget is removed from the DOM using the remove(), empty(), or html() jQuery methods only.

Event Handler Argument:

Information about the event.

Object structure:
component: Object

The widget instance.

element: jQuery

The widget's container.

model: Object

The model data. Available only if you use Knockout.

Main article: onDisposing

See Also

done

Fires when the Series and Point chart elements are ready to be accessed.

Event Handler Argument:

Information about the event.

Object structure:
component: Object
element: Object

The widget's container.

Cannot be used in themes.

To access the required series, use the getAllSeries(), getSeriesByName(seriesName) or getSeriesByPos(seriesIndex() method of the chart instance. The accessed series object allows you to access the required point and then access the point's label. The API of the Series, Point and Label objects is detailed in the Chart Elements Reference section.

To perform custom actions when the chart is drawn, handle the drawn event of the chart.

See Also

drawn

Fires when the widget has finished drawing itself.

Event Handler Argument:

Information about the event.

Object structure:
component: Object
element: Object

The widget's container.

Cannot be used in themes.
See Also

exported

Fires after data from the widget is exported.

Event Handler Argument:

Information about the event.

Object structure:
component: Object
element: jQuery

The widget's container.

model: Object

Data that is available for binding against the element. Available only in Knockout and AngularJS approaches.

To perform a custom action after data from the widget is exported, implement a handler for this event. For example, this handler can notify the user that the exporting has been completed. Within this handler, you can use the object passed to it as the parameter.

See Also

exporting

Fires before data from the widget is exported.

Event Handler Argument:

Information about the event.

Object structure:
component: Object
element: jQuery

The widget's container.

model: Object

Data that is available for binding against the element. Available only in the Knockout approach.

fileName: String

The name of the file to which the widget is about to be exported.

cancel: Boolean

Assign true to this field if you need to prevent exporting.

format: String

The resulting file format. One of PNG, PDF, JPEG, SVG and GIF.

To perform a custom action before data from the widget is exported, implement a handler for this event. Within this handler, you can use the object passed to it as the parameter. For example, using the cancel field of this object, you can cancel exporting.

See Also

fileSaving

Fires before a file with exported data is saved on the user's local storage.

Event Handler Argument:

Information about the event.

Object structure:
component: Object
element: jQuery

The widget's container.

fileName: String

The name of the file to be saved.

format: String

The format of the file to be saved.
Possible Values: 'PNG' | 'PDF' | 'JPEG' | 'SVG' | 'GIF'

data: BLOB

Exported data as a BLOB.

cancel: Boolean

Assign true to this field if you need to prevent the file from being saved.

To perform a custom action before a file with exported data is saved on the user's local storage, implement a handler for this event. Within this handler, you can use the object passed to it as the parameter. For example, using the cancel field of this object, you can cancel file saving.

See Also

incidentOccurred

Fires when an error or warning appears in a widget.

Event Handler Argument:

Information about the event.

Object structure:
component: Object
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

Raised only once, after the widget is initialized.

Event Handler Argument:

Information about the event.

Object structure:
component: Object

The widget's instance.

element: jQuery

The widget's container.

Main article: onInitialized

See Also

legendClick

Fires when an item on the chart legend is clicked.

Event Handler Argument:

Information about the event.

Object structure:
component: Object
element: Object

The widget's container.

jQueryEvent: jQuery.Event

The jQuery event.

target: String|Number

The argument of the point(s) corresponding to the clicked legend item.

points: Array

The point(s) corresponding to the clicked legend item.

Cannot be used in themes.

You can subscribe to this event using the onLegendClick option or the on(eventName, eventHandler) method.

See Also

optionChanged

Raised after an option of the widget is changed.

Event Handler Argument:

Information about the event.

Object structure:
component: Object
name: String

A short name of the option whose value has been changed.

fullName: String

A full name of the option whose value has been changed; contains a full hierarchy of the option.

value: any

A new value for the option.

element: jQuery

The widget's container.

model: Object

The model data. Available only if you use Knockout.

Main article: onOptionChanged

See Also

pointClick

Fires when a user clicks a series point.

Event Handler Argument:

Information about the event.

Object structure:
component: Object
element: Object

The widget's container.

jQueryEvent: jQuery.Event

The jQuery event.

target: Point

The clicked series point.

Cannot be used in themes.

When implementing a handling function, use the object passed to it as its parameter. Among the fields of this object, you can find the clicked series point. To learn about point members that you can use, refer to the description of the Point object. To get the parent series of the point, use the target.series field of the object passed to the handler as its parameter.

See Also

pointHoverChanged

Fires when the hover state of a series point has been changed.

Event Handler Argument:

Information about the event.

Object structure:
component: Object
element: Object

The widget's container.

target: Point

The series point whose hover state has been changed.

Cannot be used in themes.

When implementing a handling function, use the object passed to it as its parameter. Among the fields of this object, you can find the series point whose hover state has been changed. To identify whether this point was hovered over or hovered out, call its isHovered() method. To discover point fields and methods, refer to the Point class description.

See Also

pointSelectionChanged

Fires when the selection state of a series point has been changed.

Event Handler Argument:

Information about the event.

Object structure:
component: Object
element: Object

The widget's container.

target: Point

The series point whose selection state has been changed.

Cannot be used in themes.

When implementing a handling function, use the object passed to it as its parameter. Among the fields of this object, you can find the series point whose selection state has been changed. To identify whether this point was selected or deselected, call its isSelected() method. To discover point fields and methods, refer to the Point class description.

See Also

tooltipHidden

Fires when a point's tooltip becomes hidden.

Event Handler Argument:

Information about the event.

Object structure:
component: Object
element: Object

The widget's container.

target: Point

The series point whose tooltip becomes hidden.

Cannot be used in themes.

The point's tooltip becomes invisible when a user hovers the mouse cursor over another series point. In addition, you can hide a tooltip in code, using the hideTooltip() method of the chart or point.

When a tooltip is made hidden, you can perform specific actions by handling the tooltipHidden event. When implementing a handling function, use the object passed to it as its parameter. Among the fields of this object, you can find the series point whose tooltip becomes hidden.

See Also

tooltipShown

Fires when a point's tooltip appears.

Event Handler Argument:

Information about the event.

Object structure:
component: Object
element: Object

The widget's container.

target: Point

The series point whose tooltip appears.

Cannot be used in themes.

The point's tooltip appears when a user hovers the mouse cursor over the point. In addition, you can show a tooltip in code, using the showTooltip() method of the chart or point.

When a tooltip appears, you can perform specific actions by handling the tooltipShown 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. Among the fields of this object, you can find the series point whose tooltip appears.

See Also