x This domain is for sale. If you intrested, Please contact : webspeckle@gmail.com

How to create a simple JavaScript chart in html5 canvas?

Here we are creating a simple JavaScript line chart in html5 canvas by using chart.js. In this chart required X & Y axis data. Here we are using some sample data. You can replace with your own data.

You can download the latest version of Chart.js from the GitHub releases or use a Chart.js CDN.

<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.6.0/Chart.bundle.min.js"></script>
Add a '<canvas>' element to your html page.

<canvas id="myChart" width="400" height="400"></canvas>
After that we should use the chart api.

The final code & demo is here


Demo

No comments:

Post a Comment