Home › forums › Using CanvasJS › How to run CanvasJS in Salesforce Lightning
Tagged: error, lightning, salesforce
This topic contains 3 replies, has 2 voices, and was last updated by Vishwas R 6 months, 3 weeks ago.
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:
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]
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.
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 ;)
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.
You must be logged in to reply to this topic.