【问题标题】:how to add click event on echarts heatmap cell?如何在 echarts 热图单元格上添加点击事件?
【发布时间】:2021-10-11 10:05:35
【问题描述】:

当我单击其中一个单元格时,如何注册 onclick 事件?这是我关注的current example。例如,当我点击一个特定的单元格时触发警报

【问题讨论】:

    标签: reactjs echarts


    【解决方案1】:

    按照这个documentation,我就是这样做的。

    下面是我的代码

    ...
    
    triggerOnClick = () =>{
        console.log("enter");
      }
    
      onClick = {
        'click': this.triggerOnClick.bind(this)
      }
    
    
    
      render(){
        return(
          <div>
            <ReactEcharts
              option={getOtion()}
              style={{ height: "700px", width: "100%" }}
              onEvents={this.onClick}
         
          </div>
      )}
    
    

    此点击事件仅适用于热图中的单个单元格

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-07-10
      • 2021-04-25
      • 1970-01-01
      • 1970-01-01
      • 2012-09-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多