How to use the react-chartjs-2.Chart.plugins function in react-chartjs-2

To help you get started, we’ve selected a few react-chartjs-2 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cruise-automation / webviz / packages / webviz-core / src / util / installChartjs.js View on Github external
export default function installChartjs() {
  // These have the side effect of installing themselves.
  require("chartjs-plugin-annotation");
  require("chartjs-plugin-datalabels");
  require("chartjs-plugin-zoom");
  require("webviz-core/src/util/multicolorLineChart");

  // Otherwise we'd get labels everywhere.
  Chart.defaults.global.plugins.datalabels.display = false;

  setUpChartJSZoom();

  if (Chart.plugins.count() !== 6) {
    throw new Error(
      "Incorrect number of Chart.js plugins; one probably has not loaded correctly (make sure we don't have duplicate chart.js instances when running `yarn list`."
    );
  }
}