/ javascript

Chart.js - Simple JavaScript charting for designers & developers

Developer features allow extending and enhancing Chart.js in many different ways.
Chart.js is a community maintained project.

Browser support

Chart.js offers support for the following browsers:

Chrome 50+
Firefox 45+
Internet Explorer 11
Edge 14+
Safari 9+

Getting Started

Let's get started using Chart.js!

First, we need to have a canvas in our page.

<canvas id="myChart"></canvas>

Now that we have a canvas we can use, we need to include Chart.js in our page.

<script src="https://cdn.jsdelivr.net/npm/chart.js@2.8.0"></script>

Now, we can create a chart. We add a script to our page:

var ctx = document.getElementById('myChart').getContext('2d');
var chart = new Chart(ctx, {
    // The type of chart we want to create
    type: 'line',

    // The data for our dataset
    data: {
        labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
        datasets: [{
            label: 'My First dataset',
            backgroundColor: 'rgb(255, 99, 132)',
            borderColor: 'rgb(255, 99, 132)',
            data: [0, 10, 5, 2, 20, 30, 45]

    // Configuration options go here
    options: {}
Chart.js - Simple JavaScript charting for designers & developers
Share this

Subscribe to NL Slack