echarts : 香港地区显示(人口密集的人口数目) http://echarts.baidu.com/examples/editor.html?c=map-HK
series: [
{
name: '香港18区人口密度',
type: 'map',
mapType: 'HK
', // 自定义扩展图表类型
symbol:"pin",
itemStyle:{
normal:{label:{show:true,
formatter:'{b}\n{c}'
}},
emphasis:{label:{show:true}}
},
data:[
{name: '中西区', value: 20057.34},
{name: '湾仔', value: 15477.48},
{name: '东区', value: 31686.1},
{name: '南区', value: 6992.6},
{name: '油尖旺', value: 44045.49},
{name: '深水埗', value: 40689.64},
{name: '九龙城', value: 37659.78},
{name: '黄大仙', value: 45180.97},
{name: '观塘', value: 55204.26},
{name: '葵青', value: 21900.9},
{name: '荃湾', value: 4918.26},
{name: '屯门', value: 5881.84},
{name: '元朗', value: 4178.01},
{name: '北区', value: 2227.92},
{name: '大埔', value: 2180.98},
{name: '沙田', value: 9172.94},
{name: '西贡', value: 3368},
{name: '离岛', value: 806.98}
],
// 自定义名称映射
nameMap: {
'Central and Western': '中西区',
'Eastern': '东区',
'Islands': '离岛',
'Kowloon City': '九龙城',
'Kwai Tsing': '葵青',
'Kwun Tong': '观塘',
'North': '北区',
'Sai Kung': '西贡',
'Sha Tin': '沙田',
'Sham Shui Po': '深水埗',
'Southern': '南区',
'Tai Po': '大埔',
'Tsuen Wan': '荃湾',
'Tuen Mun': '屯门',
'Wan Chai': '湾仔',
'Wong Tai Sin': '黄大仙',
'Yau Tsim Mong': '油尖旺',
'Yuen Long': '元朗'
}
}
]
添加formatter:'{b}\n{c}' 可显示数据
那么可以在pyecharts 中的html文件中对应位置添加这行,即可显示!!!
"series": [
{
"symbol": "circle",
"roam": true,
"label": {
"emphasis": {
"show": true,
"textStyle": {
"fontSize": 12
}
},
"normal": {
"show": true,
"formatter":'{b}\n{c}',
"textStyle": {
"fontSize": 12
},
"position": "top"
}
},
"type": "map",
"mapType": "china",
"showLegendSymbol": false,
"data": [
{
"value": 361.1555,
"name": "\u4e0a\u6d77"
},
{
"value": 130.8591,
"name": "\u4e91\u5357"
},
{
"value": 173.7109,
"name": "\u5185\u8499\u53e4"
},
{
"value": 280.5315,
"name": "\u5317\u4eac"
},
{
"value": 57.2547,
"name": "\u5409\u6797"
},
{
"value": 279.4284,
"name": "\u56db\u5ddd"
},
{
"value": 102.4437,
"name": "\u5929\u6d25"
},
{
"value": 61.412400000000005,
"name": "\u5b81\u590f"
},
{
"value": 199.1918,
"name": "\u5b89\u5fbd"
},
{
"value": 487.5595,
"name": "\u5c71\u4e1c"
},
{
"value": 215.07510000000002,
"name": "\u5c71\u897f"
},
{
"value": 992.4857,
"name": "\u5e7f\u4e1c"
},
{
"value": 150.446,
"name": "\u5e7f\u897f"
},
{
"value": 258.3552,
"name": "\u65b0\u7586"
},
{
"value": 918.8475000000001,
"name": "\u6c5f\u82cf"
},
{
"value": 281.22979999999995,
"name": "\u6c5f\u897f"
},
{
"value": 240.6574,
"name": "\u6cb3\u5317"
},
{
"value": 253.39150000000004,
"name": "\u6cb3\u5357"
},
{
"value": 1109.0634,
"name": "\u6d59\u6c5f"
},
{
"value": 27.9435,
"name": "\u6d77\u5357"
},
{
"value": 311.653,
"name": "\u6e56\u5317"
},
{
"value": 391.36280000000005,
"name": "\u6e56\u5357"
},
{
"value": 109.33720000000001,
"name": "\u7518\u8083"
},
{
"value": 423.3532,
"name": "\u798f\u5efa" }, { "value": 2.4737999999999998, "name": "\u897f\u85cf" }, { "value": 153.69119999999998, "name": "\u8d35\u5dde" }, { "value": 175.05489999999998, "name": "\u8fbd\u5b81" }, { "value": 136.739, "name": "\u91cd\u5e86" }, { "value": 180.3254, "name": "\u9655\u897f" }, { "value": 37.389399999999995, "name": "\u9752\u6d77" }, { "value": 96.69749999999999, "name": "\u9ed1\u9f99\u6c5f" } ] }],