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

animation-高图高图阻止初始缩放效果

(animation - Highcharts Highmaps prevent initial zoom effect)

发布于 2020-11-30 11:08:05

我用Highmaps构建了一个 map,该 map最初放大到了最后一个位置:请参见小提琴

这是我的代码:

    parsed: function() {
  var chart = this.chart,
    center = chart.fromLatLonToPoint({
      lat: 50,
      lon: 10
    });

   setTimeout(function() {
     chart.mapZoom(.2, center.x, center.y);

加载 map并启动时间滑块后, map将放大。如何防止此动画?

Questioner
Johannes Christ
Viewed
0
ppotaczek 2020-11-30 23:43:36

你可以在图表级别禁用动画,并在初始缩放后将其恢复:

chart: {
  animation: false,
  ...
}

chart.update({
  chart: {
    animation: true
  }
});

现场演示: https : //jsfiddle.net/BlackLabel/xarg940y/

API参考: https //api.highcharts.com/highmaps/chart.animation