A
A
Alex_872020-10-04 18:58:45
JavaScript
Alex_87, 2020-10-04 18:58:45

How to create a canvas plot of type line?

Good evening! I'm having trouble using Chart.js to create a small line chart. With large ones, of a different type, there are no problems! 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:
5f79f0a4dbee8490032795.png

But it should be something like this:
5f79f1912bd9e669341727.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
RAX7, 2020-10-04
@Alex_87

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question