Home Forums Chart Support CanvasJS is not defined

CanvasJS is not defined

Viewing 2 posts - 1 through 2 (of 2 total)
  • #15525

    I am using CanvasJS in my angular 2 app but i am having some trouble loading my page with charts.

    I have added to my index.html page:
    <script src="https://cdn.canvasjs.com/canvasjs.min.js"></script>

    in my component.ts file i have added:

    declare var CanvasJS: any;
    var chart = new CanvasJS.Chart("chartContainer", {.....});

    but when i run this i get several errors in my console:
    Error: Error in :0:0 caused by: CanvasJS is not defined



    Creating the chart within ngOnInit() should render the chart in Angular 2. Please take a look at this sample project for integrating CanvasJS Chart with Angular 2.

    Column chart in AngularJS 2

    Sanjoy Debnath
    Team CanvasJS

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.