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 4 months ago.

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

    y4nnick
    Member

    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 :/

    #11665

    Vishwas R
    Keymaster

    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.