简体   繁体   English

高图最小和最大缩放级别

[英]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. 因为我在地图上显示的某个国家/地区,有些区域太小,即使形状正确地在GeoJSON中定义,形状也不可见,并且在其上方也有标签。

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/ 您可以参考highmaps开发人员的以下代码: 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: 在xAxis和yAxis上设置minRange属性:

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. 默认值为最小区域大小的5倍。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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