我利用下面的代码画出的地图,怎么能点击全国的时候山东不选中,点击山东的时候全国还原成没有选中的状态?
@Kener-林峰 请问 我利用下面的代码画出的地图,怎么能点击全国的时候山东不选中,点击山东的时候全国还原成没有选中的状态?
option = {
title : {
text: '',
subtext: ''
},
tooltip : {
trigger: 'item',
showDelay: 0,
hideDelay: 50,
transitionDuration:0,
backgroundColor : 'rgba(25,255,25,0.7)',
borderColor : 'rgb(255,0,0)',
borderRadius : 8,
borderWidth: 2,
padding: 10, // [5, 10, 15, 20]
textStyle : {
color: 'black',
align : 'left',
decoration: 'none',
fontFamily: 'Verdana, sans-serif',
fontSize: 15,
fontStyle: 'italic',
fontWeight: 'bold'
},
formatter : function(params,ticket,callback){
var res = (params[1] === 'China' ? '全国': params[1]) +"</br>值:"+params[2];
return res;
}
},
dataRange: {
min: 0,
max: 2500,
text:['高','低'], // 文本,默认为数值文本
calculable : true
},
toolbox: {
show : false,
orient : 'vertical',
x: 'right',
y: 'center',
feature : {
mark : {show: true},
dataView : {show: true, readOnly: false},
restore : {show: true},
saveAsImage : {show: true}
}
},
series : [
{
name: '中国',
type: 'map',
mapType: 'china',
selectedMode : 'single',
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)},
{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)},
{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)},
{name: '澳门',value: Math.round(Math.random()*1000)}
]
},{
name:"China",
type : 'map',
mapType:'world|China',
selectedMode : 'single',
mapLocation:{x:'80%',y:'50%',width:'10%',height:'15%'},
itemStyle : {
normal:{label:{show:true,formatter:'全国'}},
emphasis:{label:{show:true,formatter:'全国'}}
},
data :[{name: 'China',value: Math.round(Math.random()*1000)}]
}
]
};
var chart = echarts.init(map);
chart.setOption(option);
window.onresize = chart.resize;
chart.connect(chart);
如果你对这篇文章有疑问,欢迎到本站 社区 发帖提问或使用手Q扫描下方二维码加群参与讨论,获取更多帮助。

发布评论
需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。