javascript - Highcharts 和 highmaps 插件渲染空白地图
问题描述
所以这里是代码:
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 控制台中向我显示了这个错误“未捕获的类型错误:无法读取未定义的属性 'dataMin'”。有什么解决办法吗?提前致谢。
解决方案
我重现了您的代码,似乎一切正常:https ://jsfiddle.net/BlackLabel/cjr9p7oq/
// Create the chart
Highcharts.mapChart('container', {
...
});
这可能是新版本后与绑定文件相关的临时问题。请确认一切是否正常。
推荐阅读
- swift - 当标签栏被隐藏时,它会留下一个黑色空间
- typescript - 使用 NestJs Sequelize 的子查询
- ubuntu - Ubuntu 中的 Redis 服务器
- azure - Azure - 具有无服务器应用程序的网络安全组
- python - 使用 Anaconda 安装 Scran 包时出错
- oracle-apex - 设置会话状态 - APEX 21.1
- regex - 从表中提取所有出现的字符串
- javascript - 加载 Vue.js 表需要很长时间(加载两次)
- r - ubuntu上离线安装R catboost包
- yii2 - 使用 Codeceoption 运行验收测试时出错