这里的坐标是除以1000的
方法一:
var uploadedDataURL = {
"新疆": [91.110, 29.970],
"海口": [109.300, 18.150],
"北京": [116.231, 39.452]
}
var weiboData;
for (var key in uploadedDataURL) {
weiboData.push(uploadedDataURL[key]);
}
方法二:
var uploadedDataURL = [[91110, 29970, 90170, 29440, 116231, 39452,109300,18150]];
var weiboData = uploadedDataURL.map(function (serieData, idx) {
var px = serieData[0] / 1000;
var py = serieData[1] / 1000;
var res = [[px, py]];
for (var i = 2; i < serieData.length; i += 2) {
var dx = serieData[i] / 1000;
var dy = serieData[i + 1] / 1000;
var x = px + dx;
var y = py + dy;
res.push([dx, dy]);
px = x;
py = y;
}
console.log('结果');
console.log(res);
return res;
})
这个res的结果是:
chart('middle-map', {
// backgroundColor: '#404a59',
title: {
// text: '微博签到数据点亮中国',
// subtext: 'From ThinkGIS',
// sublink: 'http://www.thinkgis.cn/public/sina',
left: 'center',
top: 'top',
textStyle: {
color: '#fff'
}
},
legend: {
left: 'left',
data: ['强', '中', '弱'],
textStyle: {
color: '#ccc'
}
},
geo: {
name: '强',
type: 'scatter',
map: 'china',
label: {
emphasis: {
show: false
}
},
itemStyle: {
normal: {
areaColor: '#323c48',
borderColor: '#111'
},
emphasis: {
areaColor: '#2a333d'
}
}
},
series: [
{
name: '强',
type: 'scatter',
coordinateSystem: 'geo',
symbolSize: 10,// 修改圆圈大小
large: true,
itemStyle: {
normal: {
shadowBlur: 2,
shadowColor: 'rgba(255, 255, 255, 0.8)',
color: 'yellow'
}
},
data: weiboData
// data: weiboData[0]
}]
})