is like this, we have a project, need echarts map function, everything else has been adjusted, but encountered a very troublesome problem: the map suspension box displays only one set of data by default, I have tried a lot of ways, but I have not been able to make the two sets of data appear in the suspension box, here is my code. Ps: I output the first set of data in tooltip. Params, found that the output is also the first set of data.
$.get("data/hangzhou.json", function (hangzhoujson) { //json
echarts.registerMap("hangzhou", hangzhoujson); //
chart.setOption({
title: {
text: "",
subtext: "",
textStyle:{
color:"-sharpfff"
}
},
legend:{
orient: "vertical",
left: "left",
data:["1","2"]
},
tooltip: { //
trigger: "item",
/*formatter:function(params, ticket, callback){
// return params.name+":"+params.value
// console.log(params);
},*/
},
visualMap: {
min: 0,
max: 1000,
text:["High","Low"],
realtime: true,
calculable: true,
inRange: {
color: ["lightskyblue","yellow", "orangered"]
},
textStyle:{
color:"-sharpfff"
}
},
series: [{
name:"1",
type: "map", //
map: "hangzhou", //
aspectScale:1, //
roam: true, // "scale" "move" true
layoutCenter:["50%","50%"], //["50%","50%"]
layoutSize: "100%", //100%
label: {
normal: {
show: true //
},
emphasis: {
show: true //
}
},
data:[{ name:"",value:337},
{ name:"",value:37},
{ name:"",value:737},
{ name:"",value:237},
{ name:"",value:97},
{ name:"",value:137},
{ name:"",value:257},
{ name:"",value:217},
{ name:"",value:17},
{ name:"",value:837},
{ name:"",value:437},
{ name:"",value:77},
{ name:"",value:7}]
},{
name:"2",
type: "map", //
map: "hangzhou", //
aspectScale:1, //
roam: true, // "scale" "move" true
layoutCenter:["50%","50%"], //["50%","50%"]
layoutSize: "100%", //100%
label: {
normal: {
show: true //
},
emphasis: {
show: true //
}
},
data:[{ name:"",value:127},
{ name:"",value:327},
{ name:"",value:521},
{ name:"",value:27},
{ name:"",value:167},
{ name:"",value:197},
{ name:"",value:417},
{ name:"",value:207},
{ name:"",value:117},
{ name:"",value:37},
{ name:"",value:757},
{ name:"",value:27},
{ name:"",value:71}]
}]
});
});
the effect of the above code is as follows:
my second set of data does not appear in the suspension box.
how can we realize that multiple sets of data appear in the suspension box?