Chart is not defined error
when we try to use doughnutChart component following error occurs;
angular2.dev.js:23730 ReferenceError: Chart is not defined
at DoughnutChart.initChart (http://localhost:8080/node_modules/primeng/components/chart/doughnutchart/doughnutchart.js:91:30)
at DoughnutChart.ngAfterViewInit (http://localhost:8080/node_modules/primeng/components/chart/doughnutchart/doughnutchart.js:62:14)
at AbstractChangeDetector.ChangeDetector_FrontPageComponent_0.afterViewLifecycleCallbacksInternal (viewFactory_FrontPageComponent:119:82)
at AbstractChangeDetector.afterViewLifecycleCallbacks (http://localhost:8080/node_modules/angular2/bundles/angular2.dev.js:9924:12)
"angular2": "2.0.0-beta.11",
"primeng": "^0.8.1",
"primeui": "^4.1.5"
Welcome to PrimeNG, you also need to add charts.js to your page.
I've got the same Problem. chart.js implemented before angular-chartjs.
Chart is not defined. Error occurs within my .html.
@cagataycivici Could you please give a working example of chart using primeng ? and from where we have to add chart.js ?
@abbas-innotical Could you please give a working example of chart using primeng ? and from where we have to add chart.js ?
I would also like to see a working example of chart using primeng in order to see how to add it.
Adding:
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.1.3/Chart.bundle.min.js"></script>
To my index.html page, resolved this issue for me.
Y'know, the fact you have to import Chart.js isn't really mentioned on the showcase...
wow thank you , I would never have found this out.
Hi! I am working with angular (v2+) in Typescript, I added:
npm install --save chart.js
npm install --save-dev @types/chart.js
But still couldn't work with a simple:
import { Chart } from 'chart.js';
I have an issue. It seems chart.js is not typescript friendly..