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

How to create a simple JavaScript chart in div?

Here we are creating a simple JavaScript line chart in div 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.

1) 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 '<div>' element to your html page.

<div class="Chart">
After that we should use the chart api.

The final code & demo is here


Demo

No comments:

Post a Comment