Home forums Using CanvasJS Getting an Object Reference to a Chart

This topic contains 1 reply, has 2 voices, and was last updated by  Suyash Singh 4 months, 2 weeks ago.

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

    oneworld
    Member

    How does one get a reference to an existing chart. Let say I have created a chart during the window.onload() event. Later, e.g. following a user configuration change request, I want to modify the chart configuration. How to I proceed to get a reference to the existing chart from outside the window.onload() event or from outside the method in which it was originally defined?

    #14314

    Suyash Singh
    Moderator

    @oneworld,

    You can get the reference of the chart object outside of the window.onload() or any other function by either creating chart as a global variable, which is not a neat way to access the chart. Or you could pass the chart object as a parameter to the function that can access the chart as shown in this jsfiddle.


    Suyash,
    Team CanvasJS

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

You must be logged in to reply to this topic.