Closed ravitez closed 9 years ago
seems to be broken for doughnut too :(
+1 any news on this? Seeing the same issue in an ng-repeat
I think this boiled down to a data issue for me.
Sent from my iPhone
On Oct 5, 2015, at 3:13 PM, Dan Wellman notifications@github.com wrote:
+1 any news on this? Seeing the same issue in an ng-repeat
— Reply to this email directly or view it on GitHub.
I'm pretty sure it's not data, I'll post some actual code later, but by changing the class from chart-base to chart-doughnut, the chart worked as expected
Ah yes you are corrrect. I was mistaken.
Sent from my iPhone
On Oct 5, 2015, at 3:13 PM, Dan Wellman notifications@github.com wrote:
+1 any news on this? Seeing the same issue in an ng-repeat
— Reply to this email directly or view it on GitHub.
After some testing, I find this works and produces the desired graph:
<div class="chart" ng-repeat="chart in charts">
<canvas id="charts[$index].type"
class="chart chart-doughnut"
chart-data="charts[$index].data"
chart-labels="charts[$index].labels">
</canvas>
</div>
But this doesn't work:
<div class="chart" ng-repeat="chart in charts">
<canvas id="charts[$index].type"
class="chart chart-base"
chart-type="charts[$index].type"
chart-data="charts[$index].data"
chart-labels="charts[$index].labels">
</canvas>
</div>
The latter snippet results in the following console error:
TypeError: (intermediate value)[type] is not a function
Got the same error message.
I figured out, that the types start with capital letters and it worked after that.
type: 'line'
=> type: 'Line'
Great, thanks for the info!
As @draconteus said, the chart type is case sensitive.
Still does not seem to fix with capital letter.
use https://github.com/gor181/react-chartjs-2 for chart v2.0
Dynamic chart type doesn't seem to be working with bar,line..throws
TypeError: (intermediate value)[type] is not a function
Or Am I missing anything ? Here's the fiddle https://jsfiddle.net/ravitej/4Lzc2cr7/