地图添加散点图,但是展示数据的时候展示的是维度而不是数据,希望能够解答
代码
var myData = [{name: '海门', value: [121.15, 31.89, 90]},
{name: '鄂尔多斯', value: [109.78, 39.60, 120]},
{name: '招远', value: [120.38, 37.35, 142]},
{name: '舟山', value: [122.20, 29.98, 123]}]
$.get('../js/china.json', function (chinaJson) {
echarts.registerMap('chinaMap', chinaJson);
var china = echarts.init($("#china").get(0));
var chinaOption = {
geo: {
type: 'map',// map是一个固定的值
map: 'chinaMap',//chinaMap需要和registerMap中的第一个参数保持一致
roam: true,
label: {
show: true,
color: '#000000'
},
//zoom: 0.8, //地图的缩放比例, 大于1代表放大, 小于1代表缩小
//center: [87.617733, 43.792818] // 当前视角的中心点,用经纬度表示
},
tooltip: {
trigger: 'item'
},
series: [
{
name: '样本量', // series名称
type: 'scatter', // series图表类型
coordinateSystem: 'geo', // series坐标系类型
data: myData,
//散点大小
/*symbolSize: function (val) {
return val[2] / 5;
},*/
//是否显示散点地名
label: {
formatter: '{b}',
position: 'right',
show: true
}
}
]
};
china.setOption(chinaOption)
})
})
谢谢