如何给echarts legend添加点击事件

如何给echarts legend添加点击事件,第1张

option= {
                title: {
                    text:'山东省事业费开支情况',
                    textStyle:{fontSize: 20,fontWeight:'bolder',color:'#333'},
                    x:'center'
                },
                tooltip: {
                    trigger:'item'
                },
                legend: {
                    orient:'vertical',
                   x:'left',
                    data: ['开支比例']
               },
                dataRange: {
               min: 0,
               max: 1000,
               color:['orange','yellow'],
               text:['高','低'],
               x:'right',
               y:'bottom',
               calculable : true
               },
                series: [
        {
            name:'开支比例',
            type:'map',
            mapType:'山东',
            selectedMode: 'single',
            itemStyle: {
                normal: { label: { show:true },color:'black' },
                emphasis: { label: { show:true} }
            },
            mapLocation:{x:'center',y:'center'},
            mapValuePrecision:2,
            roam:false,
            data: [
 {name: "烟台市",value: Mathround(Mathrandom()1000)},
 {name: "临沂市",value: Mathround(Mathrandom()1000)},
 {name: "潍坊市",value: Mathround(Mathrandom()1000)},
 {name: "青岛市",value: Mathround(Mathrandom()1000)},
 {name: "菏泽市",value: Mathround(Mathrandom()1000)},
 {name: "济宁市",value: Mathround(Mathrandom()1000)},
 {name: "德州市",value: Mathround(Mathrandom()1000)},
 {name: "滨州市",value: Mathround(Mathrandom()1000)},
 {name: '聊城市',value: Mathround(Mathrandom()1000)},
 {name: "东营市",value: Mathround(Mathrandom()1000)},
 {name: "济南市",value: Mathround(Mathrandom()1000)},
 {name: "泰安市",value: Mathround(Mathrandom()1000)},
 {name: "威海市",value: Mathround(Mathrandom()1000)},
 {name: "日照市",value: Mathround(Mathrandom()1000)},
 {name: "淄博市",value: Mathround(Mathrandom()1000)},
 {name: "枣庄市",value: Mathround(Mathrandom()1000)},
 {name: "莱芜市",value: Mathround(Mathrandom()1000)}
  
        ],
        geoCoord: {
             "烟台":[12078,3763],
         "潍坊":[11914,3664],
         "临沂":[11835,3540],
         "青岛":[12050,3645],
         "济南":[11720,3698],
         "莱芜":[11770,3638],
         "滨州":[11787,3760],
         "聊城":[11596,3651],
         "日照":[11932,3561],
         "泰安":[11707,3616],
         "济宁":[11688,3545],
         "枣庄":[11736,3500],
         "淄博":[11808,3672],
         "德州":[11673,3732],
         "威海":[12200,3725],
         "东营":[11875,3767],
         "菏泽":[11566,3532]
        }
        },
        {
            name: '存在超支项目',
            type: 'map',
            mapType: '山东',
            data:[],
            markPoint : {
                symbol:'star',
                symbolSize : 10,
                effect : {
                    show: true,
                    color:'red',
                    shadowColor:'red',
                    //period: 10,
                    shadowBlur : 0
                },
                itemStyle:{
                    normal:{
                        label:{show:false}
                    }
                },
                data : [
  
                    {name: "菏泽", value:500}
                    
                ]
            }
        }
    ]
    };
 var ecConfig = require('echarts/config');
 myCharton(ecConfigEVENTCLICK, eConsole);
 function eConsole(param){
       alert(1111); 
    alert(paramname);
 }

以上就是关于如何给echarts legend添加点击事件全部的内容,包括:如何给echarts legend添加点击事件、、等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zz/9455987.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-28
下一篇 2023-04-28

发表评论

登录后才能评论

评论列表(0条)

保存