I need to use new chart.js to render the pie charts. However, I don’t know how to use it,
these are the steps I followed:
- Install node.js from installer then restart
- in command prompt: npm install npm -g
- add the canvas id to the place where you want to see the chart
<canvas id="myChart" width="400" height="400"></canvas>
- add the script for the chart
-
<script> var ctx = document.getElementById("myChart"); var myChart = new Chart(ctx, {
……………………………..}
-
new Chart is the constructor for the chart.
Advertisements