Stripped personal data from development repository
Samo Penic
2019-02-20 83c3f647c35477564b77cbc5b36d37d793d5442a
commit | author | age
83c3f6 1 # Getting Started
SP 2
3 Let's get started using Chart.js!
4
5 First, we need to have a canvas in our page.
6
7 ```html
8 <canvas id="myChart"></canvas>
9 ```
10
11 Now that we have a canvas we can use, we need to include Chart.js in our page.
12
13 ```html
14 <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.4.0/Chart.min.js"></script>
15 ```
16
17 Now, we can create a chart. We add a script to our page:
18
19 ```javascript
20 var ctx = document.getElementById('myChart').getContext('2d');
21 var chart = new Chart(ctx, {
22     // The type of chart we want to create
23     type: 'line',
24
25     // The data for our dataset
26     data: {
27         labels: ["January", "February", "March", "April", "May", "June", "July"],
28         datasets: [{
29             label: "My First dataset",
30             backgroundColor: 'rgb(255, 99, 132)',
31             borderColor: 'rgb(255, 99, 132)',
32             data: [0, 10, 5, 2, 20, 30, 45],
33         }]
34     },
35
36     // Configuration options go here
37     options: {}
38 });
39 ```
40
41 It's that easy to get started using Chart.js! From here you can explore the many options that can help you customise your charts with scales, tooltips, labels, colors, custom actions, and much more.
42
43 There are many examples of Chart.js that are available in the `/samples` folder of `Chart.js.zip` that is attached to every [release](https://github.com/chartjs/Chart.js/releases).