Echarts地图想实现鼠标移入,显示数据,但是给series中Data赋值,data全空的 value值是NaN
希望大佬们帮帮忙,实在不知道什么原因,统计图写法 就可以
initMap
function initMap(dataObj) {
mapChart = echarts.init(document.getElementById('map-chart'));
let option = {
tooltip: {
show: true,
trigger: 'item',
axisPointer: {
type: 'shadow'
},
position: 'inside', //设置定位很重要不然提示框会偏移
formatter: function (params) {
debugger
var relVal = '';
if (params.value>0){
relVal = params.name + '<br/>' + params.marker + params.value + ' 个';
}else {
relVal = '0 笔';
}
return relVal;
}
},
visualMap: {
min: 0,
max: maxMapDataValue,
right: '5%',
bottom: '5%',
itemHeight: 100,
itemWidth: 16,
borderWidth: 0,
inRange: {
// 渐变颜色,从小到大
color: ['#6384e8','#4d72e5','#3761e2','#204fdf','#1a3fb2','#17389e']
},
show: true,
textStyle: {
color: '#fff'
},
},
geo: {
zoom: 1,
roam: false,
map: mapChinaArea,
itemStyle: {
normal: {
// areaColor: "#013C62",
shadowColor: "#00b0ff",
shadowOffsetX: 0,
shadowOffsetY: 10,
},
emphasis: {
areaColor: "#2AB8FF",
borderWidth: 0,
color: "green",
label: {
show: false,
},
},
},
},
series: [
{
name: '业务操作统计',
type: 'map',
map: mapArea,
zoom: 1,
roam: false,
layoutCenter: ['0%', '0%'],
itemStyle: {
// areaColor: '#8d98b3',// 数据为0的颜色
areaColor: '#6c8ad4',
borderColor: "#00b0ff",
borderWidth: 1,
},
label: {
show: true,
textStyle: {
color: '#fff',
},
},
emphasis: {
label: {
show: true,
color: '#fff',
fontSize: 14,
fontWeight: 'bolder',
shadowColor: 'black',
},
itemStyle: {
areaColor: scrollColor,
// areaColor: 'orange',
borderColor: '#00b0ff',
borderWidth: 1
}
},
data: dataObj
}
]
};
mapChart.setOption(option);
$(window).resize(mapChart.resize);
$(window).trigger('resize');
addChartsMouseListener(mapChart);
// timer = getInterval();
}
不知道是不是这里的原因

具体的还要看看initMap里怎么写的