echarts同时展示三个圆环图并自定义文字颜色

 图片效果

代码 option配置;

 <div id="myChart1" :style="{ width: '464px', height: '315px' }"></div>

 showCharts() {

      let myChart1 = this.$echarts.init(document.getElementById("myChart1"));

      var option1;

      option1 = {

        tooltip: {

          trigger: "item",

        },

        series: [

          {

            type: "pie",

            radius: ["26%", "30%"],

            center: ["17%", "50%"],

            label: {

              position: "center",

              formatter: "{total|" + 30 + "}" + "\n\r" + "{active|外来车辆}",

              rich: {

                total: {

                  fontSize: 30,

                  color: "#E7DC65",

                },

                active: {

                  fontSize: 12,

                  color: "#E7DC65",

                  lineHeight: 16,

                },

              },

            },



            data: [

              { value: 25, name: "外来车辆", itemStyle: { color: "#E7DC65" } },

              { value: 5, name: "", itemStyle: { color: "#2A304E" } },

            ],

          },

          {

            type: "pie",

            radius: ["40%", "45%"],

            center: ["50%", "50%"],

            label: {

              position: "center",

              formatter:

                "{total|" + 30 + "}" + "\n\r" + "{active|场内车辆总数}",

              rich: {

                total: {

                  fontSize: 40,

                  color: "#00E2B3",

                },

                active: {

                  fontSize: 14,

                  color: "#00E2B3",

                  lineHeight: 16,

                },

              },

            },



            data: [

              { value: 25, name: "场内车辆总数", itemStyle: { color: "#00E2B3" } },

              { value: 5, name: "", itemStyle: { color: "#022245" } },

            ],

          },

          {

            type: "pie",

            radius: ["26%", "30%"],

            center: ["83%", "50%"],

            label: {

              position: "center",

              formatter: "{total|" + 30 + "}" + "\n\r" + "{active|准入车辆}",

              rich: {

                total: {

                  fontSize: 30,

                  color: "#36A6F8",

                },

                active: {

                  fontSize: 12,

                  color: "#36A6F8",

                  lineHeight: 16,

                },

              },

            },

            data: [

              { value: 25, name: "准入车辆", itemStyle: { color: "#36A6F8" } },

              { value: 5, name: "", itemStyle: { color: "#2A304E" } },

            ],

          },

        ],

      };

      option1 && myChart1.setOption(option1);

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值