Home forums Using CanvasJS store charts in external js file

This topic contains 1 reply, has 2 voices, and was last updated by  Vishwas R 2 months, 3 weeks ago.

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


    Is it possible to put all the charts
    var chart = new CanvasJS.Chart(“Chart1”, {…})
    var chart = new CanvasJS.Chart(“Chart2”, {…})
    in en external js file and then use it in multiple pages? I didn’t get it to work though :/


    Vishwas R

    You can store the complete chart as a function in external JS file. Load that JS file and call the function in multiple HTML pages where you like to show chart. Check this example.

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

You must be logged in to reply to this topic.