1

我从演示部分拿了一个 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'],

    }]
});

我该怎么做才能使缩放工作?

4

1 回答 1

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 上提交一个问题,我们将详细研究它。

于 2015-01-29T10:30:11.263 回答