Allow zoom using just the keyboard
I've written some script to allow for this at least in line charts only allowing zoom on xAxis. The code isn't the best, but it works, would be better if it was in the API.
$("#container").bind('keydown', function () {
let chart = $("#container").highcharts().xAxis[0];
var min = chart.getExtremes().min;
var max = chart.getExtremes().max;
if (event.keyCode == 107 || event.keyCode == 187) {
//zoom in
min++;
max--;
}
if (event.keyCode == 109 || event.keyCode == 189) {
//zoom out
if (min > chart.dataMin) {
min--;
}
if (max < chart.dataMax) {
max++;
}
}
if (event.keyCode == 39) {
//right arrow
if (max < chart.dataMax) {
min++;
max++;
}
}
if (event.keyCode == 37) {
//left arrow
if (min > chart.dataMin) {
min--;
max--;
}
}
chart.setExtremes(min, max);
});