javascript - 使用类型时不显示Highmaps国家地图:“mappoint”
问题描述
我在 Highcharts 中处理印度地图演示,代码如下:
// Create the chart
Highcharts.mapChart('container', {
chart: {
//type:'mappoint',
map: 'countries/in/custom/in-all-disputed'
},
title: {
text: 'Highmaps basic demo'
},
subtitle: {
text: 'Source map: <a href="http://code.highcharts.com/mapdata/countries/in/custom/in-all-disputed.js">India with disputed territories</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}'
}
}]
});
在我使用type: "mappoint"
. 我想使用mappoint
类型来显示该国各州的积分。但使用此映射点类型。我的图表消失了,随机点显示在屏幕上。
您可以在我的小提琴中看到以下示例: https ://jsfiddle.net/abnitchauhan/5naocyqw/
解决方案
为了使用mappoint
系列,您必须指定每个点的位置。
您可以通过指定纬度和经度来做到这一点。
请记住导入proj4js
库以使用lat
and lon
。
{
type: 'mappoint',
data: [{
name: 'New Delhi',
lat: 28.644800,
lon: 77.216721
}]
}
推荐阅读
- r - 如何将因素折叠成“其他”(不基于大小)
- roku - 如何在 Roku BrightScript 中获取图像?
- vb.net - 如何解决 .NET 中 Belboon Web 服务的身份验证错误?
- python - keras 神经网络的准确性差
- spring-mvc - 无法插入、更新和删除以使用 spring-data-jpa
- php - 网站不通过 ip 地址 url 加载主页 | 代码点火器
- reactjs - 如何在运行时更改 React js 环境属性文件(.env)
- python - 从列表框 Python 中删除项目
- javascript - Ionic 3 和 Azure AD B2C 实施
- php - 从控制器获取树枝的属性