Highcharts和highmaps插件呈现空白地图。

问题描述 投票:0回答:1

所以这里是代码。

var data = [
    ['tn-4431', 0],
    ['tn-sf', 1],
    ['tn-me', 2],
    ['tn-to', 3],
    ['tn-mn', 4],
    ['tn-bj', 5],
    ['tn-ba', 6],
    ['tn-bz', 7],
    ['tn-je', 8],
    ['tn-nb', 9],
    ['tn-tu', 10],
    ['tn-kf', 11],
    ['tn-ks', 12],
    ['tn-gb', 13],
    ['tn-gf', 14],
    ['tn-sz', 15],
    ['tn-sl', 16],
    ['tn-mh', 17],
    ['tn-ms', 18],
    ['tn-kr', 19],
    ['tn-ss', 20],
    ['tn-za', 21],
    ['tn-kb', 22],
    ['tn-ta', 23]
];

// Create the chart
Highcharts.mapChart('container', {
    chart: {
        map: 'countries/tn/tn-all'
    },

    title: {
        text: 'Highmaps basic demo'
    },

    subtitle: {
        text: 'Source map: <a href="http://code.highcharts.com/mapdata/countries/tn/tn-all.js">Tunisia</a>'
    },

    mapNavigation: {
        enabled: true,
        buttonOptions: {
            verticalAlign: 'bottom'
        }
    },

    colorAxis: {
        min: 0
    },

    series: [{
        data: data,
        name: 'Random data',
        states: {
            hover: {
                color: '#BADA55'
            }
        },
        dataLabels: {
            enabled: true,
            format: '{point.name}'
        }
    }]
});
<script src="https://code.highcharts.com/highcharts.js"></script>

<script src="https://code.highcharts.com/maps/modules/map.js"></script>
<script src="https://code.highcharts.com/mapdata/countries/tn/tn-all.js"></script>

<div id="container"></div>

因为我已经使用Highcharts.js在我的代码中渲染线图和极地图,我不能使用highmaps。我遵循了Highcharts地图的一般文档,并安装了Highcharts地图的插件。1天前,代码很好,它渲染了地图,但现在它在chrome控制台给我显示了这个错误 "Uncaught TypeError.Cannot read property 'dataMin' of undefined"。Cannot read property 'dataMin' of undefined".is there any solution ? thanks in advance.

javascript highcharts
1个回答
1
投票

我重现了你的代码,似乎一切正常。https:/jsfiddle.netBlackLabelcjr9p7oq

// Create the chart
Highcharts.mapChart('container', {
   ...
});

可能是新版本发布后与绑定文件有关的临时问题。请确认是否一切正常。

© www.soinside.com 2019 - 2024. All rights reserved.