carlcraig / tc-angular-chartjs

AngularJS directives for Chart.js
http://carlcraig.github.io/tc-angular-chartjs/
Other
233 stars 83 forks source link

Chart Does Not Render if Placed on Hidden Tab-Pane #44

Closed dayres closed 9 years ago

dayres commented 9 years ago

When the chart is placed inside of a tab-pane that is hidden on page-load, the legend renders, but the chart content does not. (In this case, a bar chart)

dayres commented 9 years ago

I just saw there was an existing issue for this problem.

yaronguez commented 8 years ago

Where is the existing issue? How do you fix this without a $timeout?

kikocastro commented 8 years ago

Solved by changing this:

chartObj.resize();

To:

if (chartObj.chart.canvas.parentNode.clientHeight !== 0 && chartObj.chart.canvas.parentNode.clientWidth !== 0) {
  chartObj.update();
}

Version 1.0.15