[Chartjs]-No tooltips on Chart JS line graph

2πŸ‘

βœ…

In Chart.js, array of colors for the backgroundColor and borderColor properties are for bar-type charts for instance, since you have different elements in your graph (several bars).

In the line-type, you only have one element (the line, with the fill below), so you need to set these properties with a single color.


If you change these properties to :

datasets: [{
    label: '# of Votes',
    data: [12, 19, 3, 5, 2, 3],
    backgroundColor: 'rgba(255, 99, 132, 0.2)',
    borderColor: 'rgba(255,99,132,1)',
    borderWidth: 1
}]

You will get the following result, which you can check at this fiddle :

enter image description here

Leave a comment