ECHART 在外部使用label

192 阅读1分钟

image.png 此处label为非原生label,

  <div class="echartsBox">
  //echart容器
      <div
        class="echart"
        ref="echarts"
      />
   //动态label容器   
      <div>
        <div class="dataBgBox">
          <div
            :style="{backgroundColor: color}"
            class="circular"
          />
          <div style="color:#c5dbe3;font-size: 16px;margin-left:15px">{{name}}</div>
          <div
            :style="{color: color}"
            style="font-size: 28px;margin-left:20px"
          >{{value}}</div>
          <img
            class="line"
            src="../../../assets/project-build/line.png"
            alt=""
          >
        </div>
      </div>
    </div>
 mounted() {
 //动态切换外部动态label绑定的值
    this.init()
    // 鼠标hover事件
    this.echarts.on('mouseover', params => {
      this.color = params.color
      this.name = params.name
      this.value = params.value
    })
  },