How to create a canvas line graph?
-
Good evening! I'm not quite good at using Chart.js to create a small line chart. With large, different types, no problem! My code is below:
<canvas style="width: 100%; height: 30px; display: block;" id="Atlantis-Financiers" width="153" height="30"></canvas>
var ctx = document.getElementById('Atlantis-Financiers').getContext('2d'); var chart = new Chart(ctx, { type: 'line', data: { datasets: [{ backgroundColor: 'rgb(255, 99, 132)', borderColor: 'rgb(255, 99, 132)', data: [0, 10, 5] }] }, options: {} });
And I get some kind of scribble:
And there must be something like this:
JavaScript Parker Raymond, Jan 1, 2019 -
Anonymous
1 Answers
Your Answer
To place the code, please use CodePen or similar tool. Thanks you!