放大不适用于Highmaps

时间:2015-01-27 22:24:13

标签: javascript highcharts highmaps

我从演示部分获取了一个Highmaps示例,并且放大工作正常。然后我用我自己的数据替换了数据对象,并使用我自己的GeoJSON数据更改了世界地图。

现在变焦不再起作用了。

请参阅 JSFiddle.

到目前为止,我设法简化了代码:

var geoJson = { ... }
var data = [...]

// Initiate the chart
$('#container').highcharts('Map', {

    mapNavigation: {
        enabled: true,
        navigationButtons: true
    },

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

    series: [{
        data: data,
        mapData: geoJson,
        joinBy: ['name', 'name'],

    }]
});

如何使缩放工作?

1 个答案:

答案 0 :(得分:2)

这必定是一个错误,如果您更改坐标数据,它就有效。 jsFiddle

var geoJson = {
    "type": "FeatureCollection",
        "features": [{
        "type": "Feature",
        "properties": {
            "name": "a"
        },
            "geometry": {
            "type": "Polygon",
                "coordinates": [
                [
                    [3125, 6250],
                    [5625, 6250],
                    [5624, 8750],
                    [3125, 8750],
                    [3125, 6250]
                ]
            ]
        }
    }, {
        "type": "Feature",
            "properties": {
            "name": "b"
        },
            "geometry": {
            "type": "Polygon",
                "coordinates": [
                [
                    [6875, 6250],
                    [9375, 6250],
                    [9375, 8750],
                    [6875, 8750],
                    [6875, 6250]
                ]
            ]
        }
    }]
};

// Initiate the chart
$('#container').highcharts('Map', {

    mapNavigation: {
        enabled: true,
    },

    series: [{
        mapData: geoJson
    }]
});

我建议在GitHub上filing an issue,我们会详细研究它。