woshitom
woshitom

Reputation: 5131

javascript, change default position after zoom on highcharts maps

Using highcharts (http://www.highcharts.com/maps/demo) I'm displaying the map of Asia. I would like to focus on south east asia so i'd like to add a default zoom as soon as the map is loaded. To do so i'm using:

        chart: {
            events: {
                load: function () {
                this.mapZoom(0.4, 100, 100);
                }
            }
        }

The first parameter is the strength of the zoom and I assume the second and third parameters are the coordinate of the point i'd like to zoom on. Problem is no matter what values I input for the second and third parameters the focusing point is always the same.

Any idea how I could focus on a given point?

Upvotes: 2

Views: 887

Answers (1)

mfalkus
mfalkus

Reputation: 148

You are going about this in the correct way, I expect it's just that your X/Y values are too low for the map data such that it doesn't look like the coordinates are changing after the zoom. For example, http://jsfiddle.net/kez11sm0/30/

events:{
    load: function(e){
        this.mapZoom(0.3,7000,-7500);
    }
}

The X and Y values for the zoom are based on the map data underneath, rather than the size of the plot in the browser.

Upvotes: 2

Related Questions