echarts_饼状图-空心

 

let totalNum = 32;
      let dataV = [
        { value: 1048, name: "恶意软件" },
        { value: 735, name: "窃听攻击" },
        { value: 580, name: "密码攻击" },
        { value: 484, name: "暴力破解" },
        { value: 300, name: "木马攻击" },
      ];
      const option = {
        tooltip: {
          trigger: "item",
          formatter: "{b} : {c} ({d}%)",
          textStyle: {
            fontSize: 30, //设置文字大小为14像素
          },
        },
        grid: {
          top: "10%", // grid距离容器顶部的距离
          left: "10%", // grid距离容器左侧的距离
          right: "10%", // grid距离容器右侧的距离
          bottom: "10%", // grid距离容器底部的距离
          // containLabel: true, // grid 区域是否包含坐标轴的标签
          // 其他可配置的属性...
        },
        legend: {
          orient: "vertical", // 垂直显示
          right: "20%",//legend距离canvas右边的距离
          y: "center",//legend距离canvas上面的距离
          icon: 'rect',//长方形
          selectedMode: true,
          itemWidth: 26, //图标宽
          itemHeight: 16,//图标高
          itemGap: 30,//图标上下高度
          textStyle: { //文字颜色
            color: "#fff",
            fontSize: 28,
            padding:[0,20]//文字与图形之间的左右间距
          },
        },
        title: {
          //标题位置
          left: "39%", // left的值为'left', 'center', 'right'
          top: "38%", // top middle bottom
          itemGap: 10, // 主副标题之间的间距,默认为10
          text: totalNum, // 标题文本
          textAlign: 'center',
          // 标题文本样式
          textStyle: {
            color: "#fff", // 颜色
            fontStyle: "normal", // 字体风格,'normal','italic','oblique'
            fontWeight: "700", //字体粗细 'normal','bold','bolder','lighter',数值:100-700
            fontFamily: "sans-serif", //字体系列
            fontSize: 50, //字体大小
          },
          //副标题
          subtext: "总攻击数量",
          //副标题文本样式
          subtextStyle: {
            color: "#fff", //颜色
            fontSize: 25, // 字体大小
          },
        },
        graphic: [
          {
            type: "image",
            left: "265",
            top: "85",
            z: -10,
            //bounding: "raw",
            //rotation: 0, //旋转
            //origin: [510, 100], //中心点
            scale: [0.95, 0.95], //缩放
            style: {
              image: require("@/assets/img/largeScreen/wx_type.png"),
              opacity: 1,
            },
          },
          /* {
            type: "text", // 类型,可以是文字、图片或其它类型
            id: "text1",
            left: "37%",
            top: "39%",
            style: {
              text: totalNum,
              fill: "#fff",
              fontSize: 50,
            },
          }, */
          /* {
            type: "text",
            id: "text2",
            left: "34%",
            top: "53%",
            style: {
              text: "总攻击数量",
              fill: "#fff",
              fontSize: 25,
            },
          }, */
        ],
        series: [
          {
            type: "pie",
            radius: ["60%", "75%"], //内圈,外圈
            center: ["40%", "48%"], //位置
            itemStyle: {
              emphasis: {
                opacity: 0.7,
              },
              normal: {
                //饼状图每个的颜色
                color: function (params) {
                  var colorList = [
                    "#009FE1",
                    "#14CDF1",
                    "#0FB49D",
                    "#FFD300",
                    "#6C81FF",
                  ];
                  return colorList[params.dataIndex];
                },
                borderColor: "#00275C",
                borderWidth: 10,
              },
            },
            label: {
              show: false,
              position: "center",
            },
            labelLine: {
              show: false,
            },
            data: dataV,
          },
        ],
      };

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值