Home Forums Chart Support How to run CanvasJS in Salesforce Lightning

How to run CanvasJS in Salesforce Lightning

Viewing 4 posts - 1 through 4 (of 4 total)
  • #24963

    Any idea how to run canvasjs in salesforce lightning component?

    I load jquery.canvasjs.min.js from static resources and render canvasjs in the controller:

            new CanvasJS.Chart(
                component.find("linechart").getElement(),
                dataset
            ).render();

    I receive this error: Uncaught Error in $A.getCallback() [j is not defined] … (I don’t use j variable at all.)

    When I load canvasjs.min.js I receive error: … [i is not defined]

    • This topic was modified 4 years, 12 months ago by bajlo.
    #24970

    @bajlo,

    It seems to be working fine with salesforce lightning component. Error could be because of missing jquery when using jquery.canvasjs.min.js or of some other library added in the project. I tried creating charts in salesforce lightning component with canvasjs.min.js and jquery.canvasjs.min.js separately and it seems to be working fine. Please take a look at this Github Repo for the working code that was used in creating the component with jquery.canvasjs.min.js.

    If you are still facing the issue, kindly share the complete code over Gist / Google-Drive / Onedrive so that we can try running it at our end, understand the scenario better and help you out.


    Vishwas R
    Team CanvasJS

    #24974

    Thanks @vishwas,

    Version was the problem! We have multiple versions and for some reasons I didn’t use the latest one.
    It failed with 1.9.2 but from 1.9.8 it seems to be working as expected ;)

    #25001

    @bajlo,

    We recommend you to use the latest version of CanvasJS as we keep our library updated in sync with browsers update and also improve the library by adding new features.


    Vishwas R
    Team CanvasJS

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

You must be logged in to reply to this topic.