Home Forums Chart Support Canvajs in Angular: ERROR ReferenceError: setButtonState is not defined

Canvajs in Angular: ERROR ReferenceError: setButtonState is not defined

Viewing 6 posts - 1 through 6 (of 6 total)
  • #22386


    I pretty new in CanavasJS. I try use the example of the home page: https://canvasjs.com/angular-charts/ in Angular created with ng. But I get always this error at calling chart.render():

    AppComponent.html:2 ERROR ReferenceError: setButtonState is not defined
    at n._updateOptions (canvasjs.min.js:5)
    at n._initialize (canvasjs.min.js:5)
    at n.render (canvasjs.min.js:5)
    at n.render (canvasjs.min.js:8)
    at MyGraphComponent.push../src/app/my-graph/my-graph.component.ts.MyGraphComponent.ngOnInit (my-graph.component.ts:35)
    at checkAndUpdateDirectiveInline (core.js:9035)
    at checkAndUpdateNodeInline (core.js:10299)
    at checkAndUpdateNode (core.js:10261)
    at debugCheckAndUpdateNode (core.js:10894)



    Can you kindly create and share an jsfiddle representing the issue you are facing or share a sample project over google-drive or onedrive, so that we can look into your code, understand it better and help you out?

    Priyanka M S
    Team CanvasJS


    I found out that this error occurs when you do an NPM install of canvas js and try to reference it from the “node_modules” folder. Download canvasjs.min.js to your assets folder and reference it from there. This will resolve the issue. Took me a while to figure this one out.




    Glad that you have figured it out :)

    Also, you can checkout at this gallery page for more examples for integrating CanvasJS Chart in Angular app. You can also download Angular sample project from our download page that you can run locally.

    Basic Column Chart in Angular

    Manoj Mohan
    Team CanvasJS


    if i change the import like you did i get “Uncaught ReferenceError: jQuery is not defined”, even if i have the jquery and bootstrap scripts(in the right order) in the angular.json. It works instead with the node_module import from the npm install



    It seems that jQuery is not included in your project. Please take a look at this link to import jQuery.

    Manoj Mohan
    Team CanvasJS

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

You must be logged in to reply to this topic.