angular-chartjs-directive icon indicating copy to clipboard operation
angular-chartjs-directive copied to clipboard

Error: chart[chartType] is not a function at char.js 2.0

Open lorenzogm opened this issue 10 years ago • 7 comments

Hello, thank you very much to for sharing this directive, it's very useful. However I have the following issue:

I have included charts.js v2.0 and then the directive and I get this error

Error: chart[chartType] is not a function

Any idea why the function Chart.Line() (or whatever) is not defined?

lorenzogm avatar Mar 02 '16 13:03 lorenzogm

Also getting this problem.

EvanBurbidge avatar Jul 20 '16 13:07 EvanBurbidge

Same problem.

kcampion avatar Aug 09 '16 15:08 kcampion

Chart 2.1.3 is giving me same problem

Tatenda avatar Aug 09 '16 18:08 Tatenda

No fix yet?

ghost avatar Aug 31 '16 08:08 ghost

Hi! This directive only work for chartjs v1, i.e, Chart.Line(), Chart.Bar() and etc is supported. In second version of chartjs is different:

var ctx = document.getElementById('chartId').getContext('2d'); var chart = new Chart(ctx, optionsObj);

It's recomended if you dont want use version 1, update this directive using the new way. In version one, you determine what chart type. In new version, you pass in options object the type of chart.

To get more information, read the chatjs docs: http://www.chartjs.org/docs/#chart-configuration-creating-a-chart-with-options.

Regards!

Davidpsj avatar Feb 03 '17 12:02 Davidpsj

why don't you update your module ? instead of everyone updating for himself ?

or shall we make a fork of this ? software products has to keep updating...

Xsmael avatar Feb 25 '17 21:02 Xsmael

Same problem

I found solution by using CDN for Chart.js

instead chart.js v2

sertjerm avatar Apr 19 '17 08:04 sertjerm