Skip to content

Latest commit

 

History

History
17 lines (10 loc) · 1.8 KB

migrationV2.md

File metadata and controls

17 lines (10 loc) · 1.8 KB

2.x Migration guide

chartjs-plugin-annotation plugin version 2 introduces a number of breaking changes. In order to improve performance, offer new features, and improve maintainability, it was necessary to break backwards compatibility, but we aimed to do so only when worth the benefit.

Options

A number of changes were made to the configuration options passed to the plugin configuration. Those changes are documented below.

  • xScaleID option default has been changed, now set to undefined. If the option is missing, the plugin will try to use the first scale of the chart, configured as 'x' axis. If more than one scale has been defined in the chart as 'x' axis, the option is mandatory to select the right scale.
  • yScaleID option default has been changed, now set to undefined. If the option is missing, the plugin will try to use the first scale of the chart, configured as 'y' axis. If more than one scale has been defined in the chart as 'y' axis, the option is mandatory to select the right scale.
  • When stacked scales are used, instead of the whole chart area, the designated scale area is used as fallback for xMin, xMax, yMin, yMax, xValue or yValue options.

Events

chartjs-plugin-annotation plugin version 2 introduces the interaction options, to configure which events trigger annotation interactions. By default, the plugin uses the chart interaction configuration.

  • When scatter charts are used, the interaction default mode in Chart.js is point, while, in the previous plugin version, the default was nearest.