it drives me crazy, I use Chart.js on my bootstrap tabs, but they wonโt display because the width is set to zero when loading the DOM. I finally found this, trying to understand why my schedule was not there!
I searched on the Internet and nothing seemed to fix my problem, can someone help me with this, I think I need some kind of script that displays a graph when the tab is selected and successfully loaded I use this JS:
var data = [ { value: 300, color:"#F7464A", highlight: "#FF5A5E", label: "Red" }, { value: 50, color: "#46BFBD", highlight: "#5AD3D1", label: "Green" }, { value: 100, color: "#FDB45C", highlight: "#FFC870", label: "Yellow" } ]; var options = { responsive : true, animation: true, }; var ctx1 = $("#invest-chart").get(0).getContext("2d"); var invest_chart; new Chart(ctx1).Doughnut(data, { responsive : true, animation: true, });
Along with this part of html in my tab:
<canvas id="invest-chart"></canvas>
Thanks guys!
source share