Integration
chartjs-chart-treemap can be integrated with plain JavaScript or with different module loaders. The examples below show to load the plugin in different systems.
Script Tag
Section titled “Script Tag”<script src="path/to/chartjs/dist/chart.min.js"></script><script src="path/to/chartjs-chart-treemap/dist/chartjs-chart-treemap.min.js"></script><script> let myChart = new Chart(ctx, {type: 'treemap', ...});</script>Bundlers (Webpack, Rollup, etc.)
Section titled “Bundlers (Webpack, Rollup, etc.)”import {Chart, registerables} from 'chart.js';import {TreemapController, TreemapElement} from 'chartjs-chart-treemap';
Chart.register(...registerables, TreemapController, TreemapElement);