Chartjs not showing up in Foundation5 Tabs

πŸ‘:0

As u can see, u’re executing new instance of Chart within window.onload function. This is the first reason.

Take a closer look – at the execution:

var ctx = document.getElementById("day-graph").getContext("2d");

You took the context over one canvas object, but in tabs you have three views. Sciprt cannot figure out that it should exec other charts.

U need to repeat the approach 3 times – the number of charts inside the tabs, for example:

//some previous code    
var ctx = document.getElementById("week-graph").getContext("2d");
      window.myLine = new Chart(ctx).Line(lineChartData, {
        responsive: true
      });

But for the optimalization purposes u should execucute the instance IF the tab in currently avaiable. And this thing u should do by yourself.

http://foundation.zurb.com/docs/components/tabs.html#callbacks

Leave a comment