Skip to content

Integration

chartjs-chart-circlepack can be integrated with plain JavaScript or with different module loaders. The examples below show how to load the chart type in different systems.

  • Chart.js 4.0 or newer.
  • ESM, CommonJS or UMD; all three builds ship in the package.

The script bundle registers the chart type when it loads.

<script src="path/to/chartjs/dist/chart.umd.js"></script>
<script src="path/to/chartjs-chart-circlepack/dist/chartjs-chart-circlepack.min.js"></script>
<script>
let myChart = new Chart(ctx, {type: 'circlepack', ...});
</script>

Importing the module build registers nothing; register the controller and the element yourself.

import {Chart, registerables} from 'chart.js';
import {CirclePackController, CirclePackElement} from 'chartjs-chart-circlepack';
Chart.register(...registerables, CirclePackController, CirclePackElement);