Home forums Chart Support Getting an Object Reference to a Chart

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

    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?



    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.

    Team CanvasJS

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

You must be logged in to reply to this topic.