2
votes

I'm trying to get the sample charts provided by http://jtblin.github.io/angular-chart.js . In particular the line chart This is the dataset and labels.

$scope.data = [[154, 31, 17, 4, 1]];
$scope.labels = ["A", "B", "C", "D", "E"];

This is the html template.

<canvas id="line" class="chart chart-line" chart-data="data" chart-labels="labels" chart-click="onClick">

I'm using Chart js version 1.0.2.

I keep hitting the error :

Uncaught TypeError: Cannot read property 'draw' of undefined .

EDIT : On debugging i found that this.scale within the draw property is undefined and it could be an issue where in the script is loaded before the canvas element is ready.

But i still don't quite know how to solve this. Any help will be appreciated.Thanks

1
A live example of your bug in a tool like JSFiddle would help a lot to troubleshoot this kind of issuebviale

1 Answers

0
votes

This fixed it for me. Make sure this is getting loaded.

<link rel="stylesheet" href="bower_components/angular-chart.js/dist/angular-chart.min.css.map">