Echarts之饼图鼠标移入突出高亮

Echarts版本:4.8.0,鼠标移入饼图时突出高亮,主要在series里配置
需求:
在这里插入图片描述
鼠标移入:
在这里插入图片描述
实现:


<template>
  <div
    id="pie-highlight"
    style="width: 700px; height: 300px; background: #020f2b"
  ></div>
</template>

<script>
export default {
  data() {
    return {};
  },
  created() {},
  mounted() {
    this.initChart();
  },
  methods: {
    initChart() {
      let option = {
        tooltip: {
          show: true,
          textStyle: {
            color: "#fff",
          },
        },
        legend: {
          textStyle: {
            color: "#fff",
          },
          icon: "rect",
          itemHeight: 10,
          itemWidth: 10,
          top: 10,
        },
        series: [
          {
            type: "pie",
            // radius: "70%", //圆形 往外突出高亮
            radius: ["45%", "70%"], // 圆环 radius: [a, b]  (a为内圆,b为外圆)  a > b高亮时向内收缩,b>a高亮时往外突出
            center: ["50%", "50%"],
            // hoverAnimation: false,//鼠标移入高亮,默认移入高亮
            // legendHoverLink:false,//鼠标移入图例时对应高亮,默认移入高亮
            itemStyle: {
              normal: {
                //边框
                borderWidth: 5,
                borderColor: "#003359",
              },
            },
            label: {
              show: false,
            },
            data: [
              { value: 1048, name: "搜索引擎" },
              { value: 735, name: "直接访问" },
              { value: 580, name: "邮件营销" },
              { value: 484, name: "联盟广告" },
              { value: 300, name: "视频广告" },
            ],
            labelLine: {
              show: false,
            },
          },
        ],
      };
      let myChart = this.$echarts.init(
        document.getElementById("pie-highlight")
      );
      myChart.setOption(option);
      window.addEventListener("resize", function () {
        myChart.resize();
      });
    },
  },
};
</script>

<style lang="scss" scoped>
</style>

以上

  • 3
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值