Warm tip: This article is reproduced from stackoverflow.com, please click
highcharts

Highcharts map drag & move on y axis?

发布于 2020-04-11 22:25:07

by default, you can zoom in a highcharts map then tap and hold left mouse button and you can move the map on y axis, is it possible to do this on x axis?

I have tried to use zoomType:'xy', but it does not work

this is the demo from highchart official

Questioner
jjzjx118_2
Viewed
68
ppotaczek 2020-02-03 19:46

That is a regression bug which is reported here: https://github.com/highcharts/highcharts/issues/12671

As a workaround use Highmaps v7.2.1 with the below plugin:

(function (H) {
  H.wrap(H.Chart.prototype, 'pan', function (proceed) {
    H.each(this.yAxis, function (axis) {
      axis.fixTo = null;
    });
    proceed.apply(this, Array.prototype.slice.call(arguments, 1));
  });
})(Highcharts);

Live demo: https://jsfiddle.net/BlackLabel/9ue0v4gz/

Docs: https://www.highcharts.com/docs/extending-highcharts/extending-highcharts