score:13

Accepted answer

just had a look around the highcharts source code, it looks like this may work out for you:

chart.showresetzoom();

also, in order for the button to work correctly, you should use axis.zoom instead of setting the extremes:

axis.zoom(newmin,newmax);

let me know if it works!

score:0

if you are using setextremes you can also set min and max to null to reset:

chart.xaxis[0].setextremes(null, null)

score:1

this approach works well:

if (!$('.highcharts-button').length) {
    chart.showresetzoom();
}

this is assuming that the only button that might show is the "reset zoom" button. if it is already there, don't show another.

if you don't do this check, a new button is added each time you call showresetzoom(). clicking the visible (most recent) button resets the zoom and removes the button but the older buttons are still visible and do nothing.

score:7

you can use showresetzoom, but you have to check if the reset button is already visible, otherwise it won't desapear.

if( !chart.resetzoombutton ) {
    chart.showresetzoom();
}

Related Query

More Query from same tag