Using the Chart.js

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:

  1. Install node.js from installer then restart
  2. in command prompt: npm install npm -g
  3. add the canvas id to the place where you want to see the chart
    <canvas id="myChart" width="400" height="400"></canvas>
  4. add the script for the chart
    1. <script>
      var ctx = document.getElementById("myChart");
      var myChart = new Chart(ctx, {

      ……………………………..}

new Chart is the constructor for the chart.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s