I have created a chart based on Highcharts plugin, in which I have rendered an image (a button: “zoom.png”).
This image has an onCLick event which resets my yAxis values.
I need to change the source of this image when the button is clicked; then change it back after the second click.
I managed to change the source of the image for the first click (it changes to “zoom1.png”); but when I click the button again it doesn’t revert to the original source (“zoom.png”)
Here is an example: JsFiddle.
The condition you are checking for
is invalid, as it is preceeded by
This creates the image again (in the newly created chart’s load handler) with the original
zoom.pnghence the condition is always true, except the very 1st time, when there is no image.You need to have a different check like a boolean variable out side to this chart which you will check and then flip every time it is clicked
@jsFiddle