[Chartjs]-Displaying multiple line graphs on one page

0👍

The following line is redundant.

var ctx = document.getElementById($this.attr('id'));

Instead, the $this variable is already a pointer to the element.

Meaning – you can do:

var plot = new Chart($this, {
    type: 'line',
    data: data,
});

My guess is that php is not creating two different ID’s, and javascript is left confused.

Leave a comment