Johannes Christ
Johannes Christ

Reputation: 109

Highcharts Highmaps prevent initial zoom effect

I built a map with Highmaps that initially zooms in to a lat lon position: see fiddle

Here is my code:

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

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

When the map is loaded and when the time slider is started the map zooms in. How can I prevent this animation?

Upvotes: 1

Views: 539

Answers (1)

ppotaczek
ppotaczek

Reputation: 39079

You can disable animation on the chart level and restore it after initial zoom:

chart: {
  animation: false,
  ...
}

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

Live demo: https://jsfiddle.net/BlackLabel/xarg940y/

API Reference: https://api.highcharts.com/highmaps/chart.animation

Upvotes: 4

Related Questions