Chartjs-Multiple usage of Javascript function

1👍

Based on what little information you provide, I assume you are copying and pasting that js code with different php variables. Each time you do that, you are adding code that tells the client that

window.onload = function(){
    var ctx = document.getElementById("'.$team.'").getContext("2d");
    window.myBar = new Chart(ctx).StackedBar(barChartData, {
      responsive : true
    });

if you do this more than once, you are overwriting window.onload, and only the last rewrite will happen, meaning only the last canvas will be drawn to.

0👍

You need to close (and open in some of them) the JS strings with double quotes. There are a few lines that lack them:

...labels : ["'.wypiszimiona($imiona,$nazwiska,$licznik).'"]...
...data : ["'.wypisznie($nie,$licznik).'"]...
...data : ["'.wypisztak($tak,$licznik).'"]...

I might have missed some.

Leave a comment