简体   繁体   中英

Highmaps min and max zoom level

I'm trying to define the limit the zoom level, I want to increase it, a user can go on a map. Because for some country I'm showing on the map, there is some region that is so small that the shape is not visible, even if they are correctly defined into the GeoJSON, and there is also the label over it.

You can take as reference the following code from highmaps developers: http://jsfiddle.net/gh/get/jquery/1.9.1/highslide-software/highcharts.com/tree/master/samples/maps/demo/doubleclickzoomto/

$('#container').highcharts('Map', {
        title : {
            text : 'Zoom in on country by double click'
        },
        mapNavigation: {
            enabled: true,
            enableDoubleClickZoomTo: true
        },

        colorAxis: {
            min: 1,
            max: 1000,
            type: 'logarithmic'
        },

        series : [{
            data : data,
            mapData: Highcharts.maps['custom/world'],
            joinBy: ['iso-a2', 'code'],
            name: 'Population density',
            states: {
                hover: {
                    color: '#BADA55'
                }
            }
        }]
    });

found the solution:

setting minRange property on both xAxis and yAxis:

The minimum range to display on this axis. The entire axis will not be allowed to span over a smaller interval than this, in terms of shape path coordinates. Defaults to 5 times the size of the smallest area.

$('#container').highcharts('Map', {
        title : {
            text : 'Zoom in on country by double click'
        },
        xAxis: {
            minRange: 1
        },
        yAxis: {
            minRange: 1
        },
 .....

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM