TSG
TSG

Reputation: 4617

highcharts hide zoom reset button, call zoom reset programmatically

I have a nice chart in highcharts that the user can zoom into. I really don't like the built-in ZOOM RESET button, and would like to add my own custom zoom reset button into a nav bar already present.

So my questions are: 1. Is there a way to hide the default highcharts ZOOM RESET button? 2. Is there a method/function I can call to perform the ZOOM RESET? (I can call that from my own button click)

Upvotes: 22

Views: 23573

Answers (2)

Avión
Avión

Reputation: 8386

Just get the chart and call zoomout:

chart = $("#your-chart").highcharts();
chart.zoomOut();

Upvotes: 1

Ricardo Lohmann
Ricardo Lohmann

Reputation: 26320

You can pass resetZoomButton as display: none and call zoomOut.

chart: {
    resetZoomButton: {
        theme: {
            display: 'none'
        }
    }
}

$('#resetZoom').click(function() {
    chart.zoomOut();
});

<input type="button" value="reset zoom" id="resetZoom"/>

Demo

Upvotes: 42

Related Questions