首页 新闻 会员 周边 捐助

ehcarts 地图标注不显示

0
悬赏园豆:10 [待解决问题]

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<script src="js/jquery-1.8.0.min.js" type="text/javascript"></script>
<script src="js/esl.js"></script>
</head>

<body>
<div id="main" style="height:700px; ;"></div>
<script type="text/javascript">
require.config({
paths: {
echarts: './js/echarts-map',
'echarts/chart/map': './js/echarts-map'
}
});
// Step:4 require echarts and use it in the callback.
// Step:4 动态加载echarts然后在回调函数中开始使用,注意保持按需加载结构定义图表路径
require(
[
'echarts',
'echarts/chart/map'
],
function(ec) {
//--- 初始化图表 ---
var myChart = ec.init(document.getElementById('main'));
// 自定义扩展图表类型:mapType = body
var cityMap = {
"温州市": "330300"
};
var curIndx = 0;
var mapType = [];
var mapGeoData = require('echarts/util/mapData/params');
for (var city in cityMap) {
mapType.push(city);
// 自定义扩展图表类型
mapGeoData.params[city] = {
getGeoJson: (function(c) {
var geoJsonName = cityMap[c];
return function(callback) {
$.getJSON('geoJson/china-main-city/' + geoJsonName + '.json', callback);
}
})(city)
}
}
require('echarts/util/mapData/params').params.baiduBuilding = {
getGeoJson: (function(c) {
var geoJsonName = cityMap[c];
return function(callback) {
$.getJSON('geoJson/china-main-city/330300.json', callback);
}
})(city)
}
var ecConfig = require('echarts/config');

function eConsole(param) {
// myChart2.setOption(optionContent());
// alert(param.name);
alert(param.name)
}
myChart.on(ecConfig.EVENT.CLICK, eConsole);
option = {
title: {
text: ''
},
tooltip: {
trigger: 'item'
},
toolbox: {
show: false
},
series: [{
name: '',
type: 'map',
mapType: '温州市',
itemStyle: {
normal: {
label: {
show: true
}
},
emphasis: {
label: {
show: true
}
}
},
data: [{
name: '永嘉县',
value: Math.round(Math.random() * 1000)
}, {
name: '乐清市',
value: Math.round(Math.random() * 1000)
}, {
name: '鹿城区',
value: Math.round(Math.random() * 1000)
}, {
name: '瓯海区',
value: Math.round(Math.random() * 1000)
}, {
name: '龙湾区',
value: Math.round(Math.random() * 1000)
}, {
name: '瑞安市',
value: Math.round(Math.random() * 1000)
}, {
name: '文成县',
value: Math.round(Math.random() * 1000)
}, {
name: '泰顺县',
value: Math.round(Math.random() * 1000)
}, {
name: '平阳县',
value: Math.round(Math.random() * 1000)
}, {
name: '苍南县',
value: Math.round(Math.random() * 1000)
}, {
name: '洞头县',
value: Math.round(Math.random() * 1000)
}],
markPoint: {
symbol: 'emptyCircle',
symbolSize: function(v) {
return 10 + v / 100
},
effect: {
show: true,
shadowBlur: 0
},
itemStyle: {
normal: {
label: {
show: false
}
}
},
data: [{
name: "永嘉县"
}, {
name: "乐清市"
}, {
name: "鹿城区"
}, {
name: "瑞安市"
}, {
name: "文成县"
}, {
name: "泰顺县",
}, {
name: "平阳县"
}, {
name: "苍南县"
}, {
name: "洞头县"
}]
} //point结束
,
geoCoord: {
"鹿城区": [120.65, 28.02],
"永嘉县": [120.68, 28.15],
"乐清市": [1120.95, 28.13],
"瑞安市": [1120.63, 27.78],
"平阳县": [1120.57, 27.67],
"文成县": [120.08, 27.78],
"泰顺县": [119.72, 27.57],
"苍南县": [120.4, 27.5],
"洞头县": [121.15, 27.83]
}
}]
};

var end;
myChart.setOption(option);
}
);
</script>
</body>

</html>

 

加载一张温州的地图,地图能显示,但标注不显示,在echarts 官网上的实例测试框内运行

复制var cityMap至 var end的代码,地图显示标注也显示,请问下在本地为什么只显示地图,不显示标注,页面没有报错!

金正声的主页 金正声 | 初学一级 | 园豆:41
提问于:2015-04-12 17:37
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册