New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Highstock chart does not show "Reset Zoom" button when zoom type is set to "x" #10320
Comments
Hi @LaniMoo, Related topic #979 Workaround Example: |
Thank you for the workaround, @sebastianbochan. I'd prefer to use the built-in showResetZoom() method since that's what I use elsewhere in my code instead of recreating the button completely. But is there a reason why the showResetZoom() method does not work for this scenario? Edit: Never mind I figured it out. To those who are trying to accomplish the same thing, one way to do it is to remove the event listener that prevents the Reset Zoom button from showing. Example: http://jsfiddle.net/lanimelrok/1kbd9vhx/ Please let me know if there's a better workaround for this. Thank you! |
working solution for xAxis only .reset-zoom-btn {
position: absolute;
right: 50px;
top: 5px;
} xAxis: {
type: "datetime",
ordinal: false,
events: {
afterSetExtremes() {
let btn = document.querySelector(".reset-zoom-btn");
if (btn) btn.remove();
const showBtn =
this.chart.navigator.range !== undefined &&
this.chart.navigator.size - this.chart.navigator.range > 0.1;
if (showBtn) {
btn = document.createElement("button");
btn.innerHTML = "Сбросить масштаб";
btn.className =
"btn btn-default reset-zoom-btn btn-outline-secondary btn-sm";
btn.onclick = () => {
this.chart.zoomOut();
if (btn) btn.remove();
};
this.chart.renderTo.appendChild(btn);
}
}
}
} |
In Highstock 9 it is enough to remove 'beforeShowResetZoom' event from Chart class:
Example: http://jsfiddle.net/gmdnzah4/ I would really like to have possibility to choose the behavior with options rather than using hacks and workarounds to bring back the default functionality. Navigator is really inconvenient to use to restore the default zoom. |
If you want to see a new feature added to Highcharta then please open a feature request. Commenting on a closed issue is less impactful. |
I'm commenting here only because of the fact that this page is in the top search results. I see a lot of people using ugly workarounds so I decided to share a better solution here (so it can be found). This feature has been rejected many times by the Highcharts developers (see comments above) so I see no point in creating another feature request. Although, as a paid customer, I'm deeply disappointed by the fact that sane requests get rejected. |
@zyura We are aiming in implementing the most popular feature requests. Less popular features are not rejected - the tickets should remain open until they will gain more popularity. I guess it doesn't do much if I only write about the general approach or strategy, so please point me to the rejected sane requests that we could check, address and possibly reopen. This issue was opened when we were tracking feature requests outside of GitHub issues, so it was rightfully closed as not a bug. |
zoomType
to'x'
Expected behaviour
Reset Zoom button appears.
Actual behaviour
Reset Zoom button does not appear.
Live demo with steps to reproduce
https://jsfiddle.net/lanimelrok/1gvp9s45/
If you switch the
zoomType
to'xy'
and repeat the above steps, the Reset Zoom button appears.Product version
Highstock 7.0.3
The text was updated successfully, but these errors were encountered: