zoukankan      html  css  js  c++  java
  • echarts 图例 自定义点击事件(点击图例反选显示)

    this.echart.on('legendselectchanged', function(obj) {
                    const {selected, name} = obj;
                    if (first && selected) {
                        Object.keys(selected).forEach(key => {
                            selected[key] = key === name ? true : false;
                        });
                        first = false;
                    } else {
                        let open = selected[name];
                        selected[name] = open;
                    }
                    option.legend.selected = selected;
                    this.setOption(option);
                });

    此代码是在vue的基础上写的,要注意this的指向!

  • 相关阅读:
    第52周二Restful
    第52周一
    第51周日
    第51周六
    第51周五
    第51周四
    第51周三
    第51周二
    第51周一
    第50周日
  • 原文地址:https://www.cnblogs.com/xiaxuening/p/10971983.html
Copyright © 2011-2022 走看看