score:2

Accepted answer

If chart1 is a global variable, you can do:

window['chart'+ID].series[0].update(...);

because global variables are automatically turned into properties of the window object.

If it's not a global variable, you can't do this. It would be best to make chart an array, rather than having chart1, chart2, etc. Then you could do:

chart[ID].series[0].update(...);

Related Query