echarts pie 饼图 border宽度

本文详细介绍如何使用ECharts库创建一个动态的饼图。通过设置颜色、触发器、系列类型、半径、标签样式及数据,展示了如何配置饼图以展示不同类型的水果占比。代码示例中包含了饼图的基本属性设置,如扇形点击提示、文字样式等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

效果图:

代码:

//饼图
  initPieECharts() {
    let _this = this;
    let charts: any = _this.$echarts.init(document.getElementById("mainPie"));
    charts.setOption({
      color: ["#b6e5ff", "#b2d1f3", "#00a1ff"],
      // 点击扇形 显示提示
      tooltip: {
        trigger: "item"
      },
      series: [
        {
          name: "水果",
          type: "pie",
          radius: ["35%", "60%"],
          label: {
            normal: {
              formatter: "{c}({d}%)\n{b}",
              textStyle: {
                fontWeight: "normal",
                fontSize: 12,
                color: "#178CE6"
              },
              lineHeight: 20
            }
          },
          itemStyle: {
            normal: {
              borderColor: "#ffffff",
              borderWidth: 6
            }
          },
          data: [
            {
              value: 10,
              name: "苹果"
            },
            {
              value: 30,
              name: "梨子"
            },
            {
              value: 60,
              name: "香蕉"
            }
          ]
        }
      ]
    });
  }

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值