# Migration

# Migrating to v1.0.0

# Breaking Changes

# Explicit Plugin Registration

As described in the getting started, it's now required to manually register this plugin, either globally:

Chart.plugins.register(ChartDataLabels);

or locally:

new Chart('foo', {
  plugins: [ChartDataLabels]
})

See chartjs-plugin-datalabels#42 (opens new window) for rationale behind this change.

# Extending the Option Context TS only

In order to extend the option context, you now need to use one of the methods described in this section. Peviously, this feature relied on the use of any. If for whatever reasons you need that flexibility, the old behavior can be achieved using:

import {Context} from 'chartjs-plugin-datalabels';
// OLD BEHAVIOR: NOT RECOMMENDED!
declare module 'chartjs-plugin-datalabels' {
  interface Context {
    [key: string]: any;
  }
}
Last Updated: 12/29/2020, 2:16:34 PM