# Getting Started

# Installation

# npm

npm (opens new window) npm downloads (opens new window)

npm install chartjs-plugin-deferred --save

# Bower

bower (opens new window)

bower install chartjs-plugin-deferred --save

# CDN

jsdelivr (opens new window) jsdelivr hits (opens new window)

By default, https://cdn.jsdelivr.net/npm/chartjs-plugin-deferred returns the latest (minified) version, however it's highly recommended (opens new window) to always specify a version in order to avoid breaking changes. This can be achieved by appending @{version} to the url:

https://cdn.jsdelivr.net/npm/chartjs-plugin-deferred@2.0.0    // exact version
https://cdn.jsdelivr.net/npm/chartjs-plugin-deferred@2        // latest 2.x.x

Read more about jsDeliver versioning on their website (opens new window).

# Download

github (opens new window) github downloads (opens new window)

You can download the latest version of chartjs-plugin-deferred from the GitHub releases (opens new window):

  • chartjs-plugin-deferred.js (recommended for development)
  • chartjs-plugin-deferred.min.js (recommended for production)
  • chartjs-plugin-deferred.esm.js
  • chartjs-plugin-deferred.tgz (contains all builds)
  • chartjs-plugin-deferred.zip (contains all builds)

# Integration

# HTML

<script src="https://cdn.jsdelivr.net/npm/chart.js@3.0.0/dist/chart.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/chartjs-plugin-deferred@2.0.0/dist/chartjs-plugin-deferred.min.js">

IMPORTANT

chartjs-plugin-deferred must be loaded after the Chart.js library!

Once loaded, the plugin, available under the global ChartDeferred property, needs to be registered.

# Module

import {Chart} from 'chart.js';
import ChartDeferred from 'chartjs-plugin-deferred';

# Registration

Since version 2.x, this plugin no longer registers itself automatically. It must be manually registered either globally or locally.

// Register the plugin to all charts:
Chart.register(ChartDeferred);
// OR only to specific charts:
var chart = new Chart(ctx, {
  plugins: [ChartDeferred],
  options: {
    // ...
  }
})

TIP

When imported via a <script> tag, use the global property ChartDeferred.

See also Chart.js › Using plugins (opens new window).