1π
I assume you are not using any angular directive for Chart.js (from the SO tags). If so, you need to draw the line only after the Chart.js canvas is visible. So wrap the $scope.secondGraph=false;
in a block and put the var cts=... ; new Chart(ctx).Bar...;
right after that.
Fiddle = https://jsfiddle.net/pbog134e/
Also looking at your HTML, if you dynamically want the chart to update, you either have to watch the data and labels or use something like http://jtblin.github.io/angular-chart.js/
- Chartjs-Graph (chartjs.org) does not stretch properly when sidebar(menu) is collapsed
- Chartjs-Changing chart data dynamically with C# from SQL database
0π
You are using simple canvas bit do you if Angular is aware of your chart present on the page? Itβs not!
Best approach would be to try to bring charts into Angular eco system i.e. either write your own chart directives or use a angular chart library..
Check this :
http://krispo.github.io/angular-nvd3/#/