| commit | author | age | ||
| 83c3f6 | 1 | # Integration |
| SP | 2 | |
| 3 | Chart.js can be integrated with plain JavaScript or with different module loaders. The examples below show how to load Chart.js in different systems. | |
| 4 | ||
| 5 | ## Script Tag | |
| 6 | ||
| 7 | ```html | |
| 8 | <script src="path/to/chartjs/dist/Chart.js"></script> | |
| 9 | <script> | |
| 10 | var myChart = new Chart(ctx, {...}); | |
| 11 | </script> | |
| 12 | ``` | |
| 13 | ||
| 14 | ## Webpack | |
| 15 | ||
| 16 | ```javascript | |
| 17 | import Chart from 'chart.js'; | |
| 18 | var myChart = new Chart(ctx, {...}); | |
| 19 | ``` | |
| 20 | ||
| 21 | ## Common JS | |
| 22 | ||
| 23 | ```javascript | |
| 24 | var Chart = require('chart.js'); | |
| 25 | var myChart = new Chart(ctx, {...}); | |
| 26 | ``` | |
| 27 | ||
| 28 | ## Require JS | |
| 29 | ||
| 30 | ```javascript | |
| 31 | require(['path/to/chartjs/dist/Chart.js'], function(Chart){ | |
| 32 | var myChart = new Chart(ctx, {...}); | |
| 33 | }); | |
| 34 | ``` | |
| 35 | ||
| 36 | > **Important:** RequireJS [can **not** load CommonJS module as is](http://www.requirejs.org/docs/commonjs.html#intro), so be sure to require one of the built UMD files instead (i.e. `dist/Chart.js`, `dist/Chart.min.js`, etc.). | |