带【科技感】的Echarts 图表

请添加图片描述
Echarts脚本在线地址 https://cdn.jsdelivr.net/npm/echarts@5.4.3/dist/echarts.min.js


引入Echarts 脚本后粘贴代码

vue2 代码:

<template>
  <div>
    <div ref="col-2-row-2" class="col-2-row-2"></div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      config: {
        list: [
          {name: "垃圾治理", id: "scene_type_2", value: 11},
          {name: "生活垃圾", id: "random_clap_type_3", value: 5},
          {name: "水域治理", id: "scene_type_5", value: 1},
          {name: "生活污水", id: "random_clap_type_2", value: 4},
          {name: "文明乡风", id: "random_clap_type_6", value: 10},
          {name: "农业废弃物", id: "random_clap_type_4", value: 2},
          {name: "农村厕所", id: "random_clap_type_1", value: 6},
          {name: "其他问题", id: "random_clap_type_7", value: 0},
          {name: "基础设施", id: "scene_type_3", value: 6},
          {name: "村容村貌", id: "scene_type_1", value: 19},
          {name: "蓝天守卫", id: "scene_type_4", value: 2},
        ]
      }
    }
  },
  methods: {
    initEcharts(dom, config, fn) {
      let _self = this, angle = 0, myChart
      if (this.$echarts.init) {
        myChart = this.$echarts.init(dom, null);
      } else {
        myChart = this.$echarts(dom, null);
      }
      setInterval(() => {
        angle = angle + 3
        let option = fn(_self, config, angle)
        myChart.setOption(option, true);
        // eslint-disable-next-line no-undef
        // tools.loopShowTooltip(myChart, option, {loopSeries: true});
      }, 120);
    },
    col2row2(vm, config = {}, angle = 0){
      let data = [];//角度,用来做简单的动画效果的
      let { list = [] } = config
      let _self = this;
      let img = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMYAAADGCAYAAACJm/9dAAABS2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4KPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxMzggNzkuMTU5ODI0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KFEfI6WqF5KO37H8OB69DCtBtQjCvTM76ADnxcjZ5pfLJ1CXr2x1OBzaYkqkUYIUuBMcAxRIsSQe3gK4E/oTmQ0dmbVrGMRs/sT+jciXj/bQVwLHrmS7M3LT2qTRghT6ORkcODdEhfNAeyFB0schmwY+bWlT9D0LN5DT2rSejZhTyNnu0hwILMrcuAahVGyGJUe3wdHWnbEntvX7SP+F3gMbTUZAC1ywAkgMfQGqZb0TMKaUHP8OvomS7O1rxsqWtdUlOLVoejGdnzgD0S3v8IreGZi4I0fJydabmwHWoKTUR9tKRBitXo0MefkVI4zDxpam5MfL3WhBFSj/Z/nI/W7DQkXNOCdpE9jbbhVsSMbTcYARwFHI2aQ4X+748jQTQDWzKzLmMKCaNv4qvVzxbg2eBve/SLeTowjmg3WQP6NT02yL+Lmg/Lgr9VRGGAypU+SAijg7/DgF0LXLsZiWA2Cp68PgP7ypZarTEKMQzVIOPRr+rWJgivRkPA5cxVaIi1EJ+i2vAJVEOU7WrXtHCN0T3WovU+96DO6OEoksk4FNqn0n9F2tC+iGZUWy4CNuZqUZliYRRmI5pND2fUd0JDwKPRMGVLgfvKiRa0EegF1PxbDnyQq0UVwv8BNYmwIpIWBvwAAAAASUVORK5CYII='
      let color=['#FF801C', '#F5FF46', '#00FE65', '#00FEFF', '#ffa800', '#ff5b00', '#ff3000']
      let seriesOption = [
          {
              name: '',
              type: 'pie',
              clockWise: false,
              radius: ['33%', '38%'],
              y: '-25%',
              hoverAnimation: false,
              label: {
                  show: true,
                  position: 'outside',
                  color: '#ddd',
                  normal: {
                    show: true,
                    textStyle: {
                      fontSize: 12,
                      color: '#bbd0e8'
                    }
                  },
                  
              },
              itemStyle: {
                  normal: {
                      labelLine: {
                          length: 20,
                          length2: 40,
                          show: true,
                          color: '#00ffff',
                      },
                        // 数据 百分比
                      label: {
                        formatter: function (params) {
                            let percent = 0;
                            let total = 0;
                            for (let i = 0; i < list.length; i++) {
                                total += list[i].value;
                            }
                            percent = ((params.value / total) * 100).toFixed(0);
                            if (params.name !== '') {
                                return params.name + ':' + percent + '%';
                            } else {
                                return '';
                            }
                        },
                      }
                  },
              },
              data: data,
          },
          // 外线
          {
              name: 'ring5',
              type: 'custom',
              coordinateSystem: 'none',
              renderItem: function (params, api) {
                  return {
                      type: 'arc',
                      shape: {
                          cx: api.getWidth() / 2,
                          cy: api.getHeight() / 2.65,
                          r: Math.min(api.getWidth(), api.getHeight()) / 3.3,
                          startAngle: ((0 + angle) * Math.PI) / 180,
                          endAngle: ((90 + angle) * Math.PI) / 180,
                      },
                      style: {
                          stroke: '#00FEFF',
                          fill: 'transparent',
                          lineWidth: 1.5,
                      },
                      silent: true,
                  };
              },
              data: [0],
          },
          // 外点
          {
              name: 'ring5', //紫点
              type: 'custom',
              coordinateSystem: 'none',
              renderItem: function (params, api) {
                  let x0 = api.getWidth() / 2;
                  let y0 = api.getHeight() / 2.68;
                  let r = Math.min(api.getWidth(), api.getHeight()) / 3.3;
                  let point = _self.getCirlPoint(x0, y0, r, 90 + angle);
                  return {
                      type: 'circle',
                      shape: {
                          cx: point.x,
                          cy: point.y,
                          r: 4,
                      },
                      style: {
                          stroke: '#00FEFF', //绿
                          fill: '#00FEFF',
                      },
                      silent: true,
                  };
              },
              data: [0],
          },

          // 外线
          {
              name: 'ring5',
              type: 'custom',
              coordinateSystem: 'none',
              renderItem: function (params, api) {
                  return {
                      type: 'arc',
                      shape: {
                          cx: api.getWidth() / 2,
                          cy: api.getHeight() / 2.68,
                          r: Math.min(api.getWidth(), api.getHeight()) / 3.3,
                          startAngle: ((180 + angle) * Math.PI) / 180,
                          endAngle: ((270 + angle) * Math.PI) / 180,
                      },
                      style: {
                          stroke: '#00FEFF',
                          fill: 'transparent',
                          lineWidth: 1.5,
                      },
                      silent: true,
                  };
              },
              data: [0],
          },
          // 蓝色 -- 外点
          {
              name: 'ring5', 
              type: 'custom',
              coordinateSystem: 'none',
              renderItem: function (params, api) {
                  let x0 = api.getWidth() / 2;
                  let y0 = api.getHeight() / 2.68;
                  let r = Math.min(api.getWidth(), api.getHeight()) / 3.3;
                  let point = _self.getCirlPoint(x0, y0, r, 180 + angle);
                  return {
                      type: 'circle',
                      shape: {
                          cx: point.x,
                          cy: point.y,
                          r: 4,
                      },
                      style: {
                          stroke: '#00FEFF', //绿
                          fill: '#00FEFF',
                      },
                      silent: true,
                  };
              },
              data: [0],
          },
          {
              name: 'ring5',
              type: 'custom',
              coordinateSystem: 'none',
              renderItem: function (params, api) {
                  return {
                      type: 'arc',
                      shape: {
                          cx: api.getWidth() / 2,
                          cy: api.getHeight() / 2.68,
                          r: Math.min(api.getWidth(), api.getHeight()) / 3.8,
                          startAngle: ((270 + -angle) * Math.PI) / 180,
                          endAngle: ((40 + -angle) * Math.PI) / 180,
                      },
                      style: {
                          stroke: '#00FEFF',
                          fill: 'transparent',
                          lineWidth: 1.5,
                      },
                      silent: true,
                  };
              },
              data: [0],
          },
          // 橘色
          {
              name: 'ring5',
              type: 'custom',
              coordinateSystem: 'none',
              renderItem: function (params, api) {
                  return {
                      type: 'arc',
                      shape: {
                          cx: api.getWidth() / 2,
                          cy: api.getHeight() / 2.68,
                          r: Math.min(api.getWidth(), api.getHeight()) / 3.8,
                          startAngle: ((90 + -angle) * Math.PI) / 180,
                          endAngle: ((220 + -angle) * Math.PI) / 180,
                      },
                      style: {
                          stroke: '#00FEFF',
                          fill: 'transparent',
                          lineWidth: 1.5,
                      },
                      silent: true,
                  };
              },
              data: [0],
          },
          {
              name: 'ring5',
              type: 'custom',
              coordinateSystem: 'none',
              renderItem: function (params, api) {
                  let x0 = api.getWidth() / 2;
                  let y0 = api.getHeight() / 2.68;
                  let r = Math.min(api.getWidth(), api.getHeight()) / 3.8;
                  let point = _self.getCirlPoint(x0, y0, r, 90 + -angle);
                  return {
                      type: 'circle',
                      shape: {
                          cx: point.x,
                          cy: point.y,
                          r: 4,
                      },
                      style: {
                          stroke: '#00FEFF', //粉
                          fill: '#00FEFF',
                      },
                      silent: true,
                  };
              },
              data: [0],
          },
          {
              name: 'ring5', //绿点
              type: 'custom',
              coordinateSystem: 'none',
              renderItem: function (params, api) {
                  let x0 = api.getWidth() / 2;
                  let y0 = api.getHeight() / 2.68;
                  let r = Math.min(api.getWidth(), api.getHeight()) / 3.8;
                  let point = _self.getCirlPoint(x0, y0, r, 270 + -angle);
                  return {
                      type: 'circle',
                      shape: {
                          cx: point.x,
                          cy: point.y,
                          r: 4,
                      },
                      style: {
                          stroke: '#00FEFF', //绿
                          fill: '#00FEFF',
                      },
                      silent: true,
                  };
              },
              data: [0],
          },
      ];
      for (let i = 0; i < list.length; i++) {
          data.push(
              {
                  value: list[i].value,
                  name: list[i].name,
                  itemStyle: {
                      normal: {
                          borderWidth: 5,
                          shadowBlur: 20,
                          borderColor: color[i],
                          shadowColor: color[i],
                      },
                  },
              },
              {
                  value: 2,
                  name: '',
                  itemStyle: {
                    label: {
                        show: false,
                    },
                    normal: {
                        labelLine: {
                          show: false,
                        },
                        color: 'rgba(0, 0, 0, 0)',
                        borderColor: 'rgba(0, 0, 0, 0)',
                        borderWidth: 0,
                    },
                  },
              }
          )
        }
    return {
          color,
          title: {
              text: '问题类型',
              textAlign: 'center',
              left: '49%',
              top: '34%',
              textStyle: {
                  fontWeight: 'normal',
                  fontSize: 14,
                  color: '#bbd0e8',
                  textAlign: 'center',
              },
          },
          // 内环
          graphic: {
              elements: [
                  {
                      type: 'image',
                      z: 3,
                      style: {
                          image: img,
                          width: 80,
                          height: 80,
                      },
                      left: 'center',
                      top: '25%',
                      position: [100, 100],
                  },
              ],
          },
          tooltip: {
              show: false,
          },
          legend: {
              icon: 'circle',
              orient: 'horizontal',
              y: '76%',
              data: list.map(i => i.name),
              align: 'left',
              textStyle: {
                  fontSize: 12,
                  color: '#bbd0e8',
              },
              itemGap: 5,
          },
          toolbox: {
              show: false,
          },
          series: seriesOption,
      };
    },
     //获取圆上面某点的坐标(x0,y0表示坐标,r半径,angle角度)
    getCirlPoint(x0, y0, r, angle) {
      let x1 = x0 + r * Math.cos(angle * Math.PI / 180)
      let y1 = y0 + r * Math.sin(angle * Math.PI / 180)
      return {
          x: x1,
          y: y1
      }
    }
  },
  mounted() {
    let _self = this;
    _self.$nextTick(() => {
      _self.initEcharts(_self.$refs['col-2-row-2'], _self.config, _self.col2row2)
    })
  }
}
</script>
<style lang="scss" scoped>
.col-2-row-2 {
  width: 400px;
  height: 300px;
  background-color: rgb(4, 36, 63);
}
</style>

因为Vue2 停止维护了嘛,所以我们要与时俱进。


Vue3 + Ts 版本:

需要注意:
this.dom.getContext is not a function
这个报错是指图表的实例对象只能通过document 获取,不可以用ref<'ElFormInstance>()
也就是27行和30行

“echarts”指 UMD 全局,但当前文件是模块。请考虑改为添加导入
这句说的是echarts应该通过全局引入的方式,可以通过npm安装echarts 解决,也可以在适当的位置全局引入echarts 脚本

<template>
  <div class="p-2">
    <div ref="col2Row2" class="col-2-row-2"></div>
  </div>
</template>

<script setup name="echarts" lang="ts">
import { getCurrentInstance, ref } from 'vue';

// 数据列表
const config = reactive({
  list: [
    {name: "垃圾治理", id: "scene_type_2", value: 11},
    {name: "生活垃圾", id: "random_clap_type_3", value: 5},
    {name: "水域治理", id: "scene_type_5", value: 1},
    {name: "生活污水", id: "random_clap_type_2", value: 4},
    {name: "文明乡风", id: "random_clap_type_6", value: 10},
    {name: "农业废弃物", id: "random_clap_type_4", value: 2},
    {name: "农村厕所", id: "random_clap_type_1", value: 6},
    {name: "其他问题", id: "random_clap_type_7", value: 0},
    {name: "基础设施", id: "scene_type_3", value: 6},
    {name: "村容村貌", id: "scene_type_1", value: 19},
    {name: "蓝天守卫", id: "scene_type_4", value: 2},
  ]
})
// 图表ref
const col2Row2 = ref<ElFormInstance>();

onMounted(() => {
  initEcharts(document.querySelector('.col-2-row-2'), config, row2Config)
})

// 初始化
const initEcharts = (dom: any, config: Object, fn: Function) => {
  let _self = this, angle = 0;
  let myChart = echarts.init(dom, undefined);
  setInterval(() => {
    angle = angle + 3
    let option = fn(_self, config, angle)
    myChart.setOption(option, true);
    // eslint-disable-next-line no-undef
    // tools.loopShowTooltip(myChart, option, {loopSeries: true});
  }, 120);
}

// 配置
const row2Config = (vm:any, config = {list: []}, angle = 0) => {
  let data:any = [];//角度,用来做简单的动画效果的
  let { list = [{value: '', name: ''}] } = config
  let _self = this;
  let img = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMYAAADGCAYAAACJm/9dAAABS2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4KPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxMzggNzkuMTU5ODI0LCAyMDE2LzA5LzE0LTAxOjA5OjAxICAgICAgICAiPgogPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIi8+CiA8L3JkZjpSREY+CjwveDp4bXBtZXRhPgo8P3hwYWNrZXQgZW5kPSJyIj8+IEmuOgAAE/9JREFUeJztnXmQVeWZxn/dIA2UgsriGmNNrEQNTqSio0IEFXeFkqi4kpngEhXjqMm4MIldkrE1bnGIMmPcUkOiIi6gJIragLKI0Songo5ZJlHGFTADaoRuhZ4/nnPmnO4+l+7bfc85d3l+VV18373n3Ptyvve53/5+da1L6jDdYjgwBhgNHALMBn6Sq0VdcxlwGvACsAx4HliTq0VlRlNzY+LrfTO2o5LoDxwOHAmMA/4WiP+KzM3DqCJpAA4K/i4F2oBXgWbgWWAxsDEv48oZC6M9Q4EJwInAMcDAfM0pOXXA14K/y4FPgQXAfOBxYF1+ppUXFgYMBiYCp6PaoU+B694HFqEmyVJgVSbW9Y6bgCeBb6Am4GHALrH3B6L/+0RgM6pFHgQeAzZkaWi5UV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wAAAAASUVORK5CYII='
  let color=['#FF801C', '#F5FF46', '#00FE65', '#00FEFF', '#ffa800', '#ff5b00', '#ff3000']
  let seriesOption = [
    {
      name: '',
      type: 'pie',
      clockWise: false,
      radius: ['33%', '38%'],
      y: '-25%',
      hoverAnimation: false,
      label: {
        show: true,
        position: 'outside',
        color: '#ddd',
        normal: {
          show: true,
          textStyle: {
            fontSize: 12,
            color: '#bbd0e8'
          }
        },
      },
      itemStyle: {
        normal: {
          labelLine: {
            length: 20,
            length2: 40,
            show: true,
            color: '#00ffff',
          },
          // 数据 百分比
          label: {
            formatter: function (params:any) {
              let percent:number = 0;
              let total:number = 0;
              for (let i = 0; i < list.length; i++) {
                total += +(list[i].value);
              }
              percent = +((params.value / total) * 100).toFixed(0);
              if (params.name !== '') {
                return params.name + ':' + percent + '%';
              } else {
                return '';
              }
            },
          }
        },
      },
      data: data,
    },
    // 外线
    {
      name: 'ring5',
      type: 'custom',
      coordinateSystem: 'none',
      renderItem: function (params:any, api:any) {
        return {
          type: 'arc',
          shape: {
            cx: api.getWidth() / 2,
            cy: api.getHeight() / 2.65,
            r: Math.min(api.getWidth(), api.getHeight()) / 3.3,
            startAngle: ((0 + angle) * Math.PI) / 180,
            endAngle: ((90 + angle) * Math.PI) / 180,
          },
          style: {
            stroke: '#00FEFF',
            fill: 'transparent',
            lineWidth: 1.5,
          },
          silent: true,
        };
      },
      data: [0],
    },
    // 外点
    {
      name: 'ring5', //紫点
      type: 'custom',
      coordinateSystem: 'none',
      renderItem: function (params:any, api:any) {
        let x0 = api.getWidth() / 2;
        let y0 = api.getHeight() / 2.68;
        let r = Math.min(api.getWidth(), api.getHeight()) / 3.3;
        let point = getCirlPoint(x0, y0, r, 90 + angle);
        return {
          type: 'circle',
          shape: {
            cx: point.x,
            cy: point.y,
            r: 4,
          },
          style: {
            stroke: '#00FEFF', //绿
            fill: '#00FEFF',
          },
          silent: true,
        };
      },
      data: [0],
    },
    // 外线
    {
      name: 'ring5',
      type: 'custom',
      coordinateSystem: 'none',
      renderItem: function (params:any, api:any) {
        return {
          type: 'arc',
          shape: {
            cx: api.getWidth() / 2,
            cy: api.getHeight() / 2.68,
            r: Math.min(api.getWidth(), api.getHeight()) / 3.3,
            startAngle: ((180 + angle) * Math.PI) / 180,
            endAngle: ((270 + angle) * Math.PI) / 180,
          },
          style: {
            stroke: '#00FEFF',
            fill: 'transparent',
            lineWidth: 1.5,
          },
          silent: true,
        };
      },
      data: [0],
    },
    // 蓝色 -- 外点
    {
      name: 'ring5', 
      type: 'custom',
      coordinateSystem: 'none',
      renderItem: function (params:any, api:any) {
        let x0 = api.getWidth() / 2;
        let y0 = api.getHeight() / 2.68;
          let r = Math.min(api.getWidth(), api.getHeight()) / 3.3;
          let point = getCirlPoint(x0, y0, r, 180 + angle);
          return {
            type: 'circle',
            shape: {
              cx: point.x,
              cy: point.y,
              r: 4,
            },
            style: {
              stroke: '#00FEFF', //绿
              fill: '#00FEFF',
            },
            silent: true,
          };
        },
      data: [0],
    },
    {
      name: 'ring5',
      type: 'custom',
      coordinateSystem: 'none',
      renderItem: function (params:any, api:any) {
        return {
          type: 'arc',
            shape: {
              cx: api.getWidth() / 2,
              cy: api.getHeight() / 2.68,
              r: Math.min(api.getWidth(), api.getHeight()) / 3.8,
              startAngle: ((270 + -angle) * Math.PI) / 180,
              endAngle: ((40 + -angle) * Math.PI) / 180,
            },
            style: {
              stroke: '#00FEFF',
              fill: 'transparent',
              lineWidth: 1.5,
            },
            silent: true,
          };
        },
      data: [0],
    },
    // 橘色
    {
      name: 'ring5',
      type: 'custom',
      coordinateSystem: 'none',
      renderItem: function (params:any, api:any) {
        return {
          type: 'arc',
          shape: {
            cx: api.getWidth() / 2,
            cy: api.getHeight() / 2.68,
            r: Math.min(api.getWidth(), api.getHeight()) / 3.8,
            startAngle: ((90 + -angle) * Math.PI) / 180,
            endAngle: ((220 + -angle) * Math.PI) / 180,
          },
          style: {
            stroke: '#00FEFF',
            fill: 'transparent',
            lineWidth: 1.5,
          },
          silent: true,
        };
      },
      data: [0],
    },
    {
      name: 'ring5',
      type: 'custom',
      coordinateSystem: 'none',
      renderItem: function (params:any, api:any) {
        let x0 = api.getWidth() / 2;
        let y0 = api.getHeight() / 2.68;
        let r = Math.min(api.getWidth(), api.getHeight()) / 3.8;
        let point = getCirlPoint(x0, y0, r, 90 + -angle);
        return {
          type: 'circle',
          shape: {
            cx: point.x,
            cy: point.y,
            r: 4,
          },
          style: {
            stroke: '#00FEFF', //粉
            fill: '#00FEFF',
          },
          silent: true,
        };
      },
      data: [0],
    },
    {
      name: 'ring5', //绿点
      type: 'custom',
      coordinateSystem: 'none',
      renderItem: function (params:any, api:any) {
        let x0 = api.getWidth() / 2;
        let y0 = api.getHeight() / 2.68;
        let r = Math.min(api.getWidth(), api.getHeight()) / 3.8;
        let point = getCirlPoint(x0, y0, r, 270 + -angle);
        return {
          type: 'circle',
          shape: {
            cx: point.x,
            cy: point.y,
            r: 4,
          },
          style: {
            stroke: '#00FEFF', //绿
            fill: '#00FEFF',
          },
          silent: true,
        };
      },
      data: [0],
    },
  ];
  for (let i = 0; i < list.length; i++) {
    data.push(
      {
        value: list[i].value,
        name: list[i].name,
        itemStyle: {
          normal: {
            borderWidth: 5,
            shadowBlur: 20,
            borderColor: color[i],
            shadowColor: color[i],
          },
        },
      },
      {
        value: 2,
        name: '',
        itemStyle: {
          label: {
            show: false,
          },
          normal: {
            labelLine: {
              show: false,
            },
            color: 'rgba(0, 0, 0, 0)',
            borderColor: 'rgba(0, 0, 0, 0)',
            borderWidth: 0,
          },
        },
      }
    )
  }
  return {
    color,
    title: {
      text: '问题类型',
      textAlign: 'center',
      left: '49%',
      top: '34%',
      textStyle: {
        fontWeight: 'normal',
        fontSize: 14,
        color: '#bbd0e8',
        textAlign: 'center',
      },
    },
    // 内环
    graphic: {
      elements: [
        {
          type: 'image',
          z: 3,
          style: {
            image: img,
            width: 80,
            height: 80,
          },
          left: 'center',
          top: '25%',
          position: [100, 100],
        },
      ],
    },
    tooltip: {
      show: false,
    },
    legend: {
      icon: 'circle',
      orient: 'horizontal',
      y: '76%',
      data: list.map(i => i.name),
      align: 'left',
      textStyle: {
        fontSize: 12,
        color: '#bbd0e8',
      },
      itemGap: 5,
    },
    toolbox: {
      show: false,
    },
    series: seriesOption,
  };
}

//获取圆上面某点的坐标(x0,y0表示坐标,r半径,angle角度)
const getCirlPoint = (x0:number, y0:number, r:number, angle:number) => {
  let x1 = x0 + r * Math.cos(angle * Math.PI / 180)
  let y1 = y0 + r * Math.sin(angle * Math.PI / 180)
  return {
    x: x1,
    y: y1
  }
}

</script>
<style lang="scss" scoped>
.col-2-row-2 {
  width: 400px;
  height: 300px;
  background-color: rgb(4, 36, 63);
}
</style>


到底了!原创不易,转载请注明出处。
请添加图片描述

  前端的学习不是一蹴而就,不积跬步无以至千里,不积小流无以成江海。持续不断的努力才能让你我有所收获

推荐阅读:

Vue自定义轮播
Vue动态换肤
css圣诞树 立体模型
vue Tips 轻提示
vue系列自定义加载页
CSS手绘图形

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/349191.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

PHP - Yii2 异步队列

1. 前言使用场景 在 PHP Yii2 中&#xff0c;队列是一种特殊的数据结构&#xff0c;用于处理和管理后台任务。队列允许我们将耗时的任务&#xff08;如发送电子邮件、push通知等&#xff09;放入队列中&#xff0c;然后在后台异步执行。这样可以避免在处理大量请求时阻塞主应用…

sklearn 学习-混淆矩阵 Confusion matrix

混淆矩阵Confusion matrix&#xff1a;也称为误差矩阵&#xff0c;通过计算得出矩阵的结果用来表示分类器的精度。其每一列代表预测值&#xff0c;每一行代表的是实际的类别。 from sklearn.metrics import confusion_matrixy_true [2, 0, 2, 2, 0, 1] y_pred [0, 0, 2, 2, 0…

ICMP协议详解

ICMP&#xff08;Internet Control Message Protocol&#xff09;协议是一个网络层协议。 一个新搭建好的网络&#xff0c;往往需要先进行一个简单的测试&#xff0c;来验证网络是否畅通&#xff1b;但是IP协议并不提供可靠传输。如果丢包了&#xff0c;IP协议并不能通知传输层…

【Kafka】开发实战和Springboot集成kafka

目录 消息的发送与接收生产者消费者 SpringBoot 集成kafka服务端参数配置 消息的发送与接收 生产者 生产者主要的对象有&#xff1a; KafkaProducer &#xff0c; ProducerRecord 。 其中 KafkaProducer 是用于发送消息的类&#xff0c; ProducerRecord 类用于封装Kafka的消息…

2023中国高速公路信息化发展盘点

文章目录 前言一、政策规范(一)《加快建设交通强国五年行动计划(2023—2027年)》(二)《关于推进公路数字化转型 加快智慧公路建设发展的意见》(三)《公路工程设施支持自动驾驶技术指南》(四)《贵州省智慧高速公路建设指南(试行)》(五)江苏省《智慧公路车路协同路…

监听元素宽高变化---new ResizeObserver

参考&#xff1a;ResizeObserver API详解-CSDN博客 有的时候需要监听某个元素的宽高变化&#xff0c;这个时候可以使用JS的 resizeObserver 钩子函数。 用于监视元素的大小变化。它可以观察一个或多个 DOM 元素&#xff0c;以便在元素的大小或形状发生变化时触发回调函数。R…

VsCode提高生产力的插件推荐-持续更新中

别名路径跳转 自定义配置// 文件名别名跳转 "alias-skip.mappings": { "~/": "/src", "views": "/src/views", "assets": "/src/assets", "network": "/src/network", "comm…

深圳工业元宇宙赋能新型工业化,推动工业制造业数字化转型发展

在当今数字化时代&#xff0c;工业制造业正面临着巨大的变革。随着技术的不断进步&#xff0c;工业元宇宙的概念逐渐成为推动工业制造业数字化转型的重要力量。深圳作为中国的高科技之都&#xff0c;在这方面走在了前列&#xff0c;积极探索工业元宇宙的应用&#xff0c;赋能新…

引领未来:云原生在产品、架构与商业模式中的创新与应用

文章目录 一、云原生产品创新二、云原生架构设计三、云原生商业模式变革《云原生落地 产品、架构与商业模式》适读人群编辑推荐内容简介目录 随着云计算技术的不断发展&#xff0c;云原生已经成为企业数字化转型的重要方向。接下来将从产品、架构和商业模式三个方面&#xff0c…

【洛谷】P1135奇怪的电梯(DFS)

这题利用 dfs 解决&#xff0c;编程实现比较简单。 具体来说&#xff0c;每层楼有两种可能&#xff0c;上楼或下楼&#xff0c;因此可以形成一个以 a 楼为根的二叉树&#xff0c;因此只需一个 for 循环遍历某个父节点的两个子节点&#xff0c;之后递归就行。 易错点&#xff…

浅出深入-机器学习

文章目录 一、K近邻算法1.1 先画一个散列图1.2 使用K最近算法建模拟合数据1.3 进行预测1.4 K最近邻算法处理多元分类问题1.5 K最近邻算法用于回归分析1.6 K最近邻算法项目实战-酒的分类1.6.1 对数据进行分析1.6.2 生成训练数据集和测试数据集1.6.3 使用K最近邻算法对数据进行建…

手把手教你用plotly绘制excel中常见的8种图表

目录&#xff1a; 0. 准备工作 1. 柱状图 2. 条形图 3. 折线图 4. 面积图 5. 饼图与圆环图 6. 散点图 7. 气泡图 8. 极坐标(雷达图) 0. 准备工作 我这边是在jupyterlab中演示的plotly图表&#xff0c;如果只安装plotly是无法正常显示图表的&#xff08;会显示为空白…

Mac怎么录屏?简单易懂,关键技巧分享!

随着时代的变迁&#xff0c;人们对mac电脑的使用需求也越来越多样化。其中&#xff0c;屏幕录制成为了很多用户的常用需求&#xff0c;比如录制教程、游戏视频、会议记录等。可是很多用户不知道mac怎么录屏。本文将为你详细介绍两种mac录屏的方法&#xff0c;让大家轻松学会如何…

Internet Download Manager 6.42.3 (IDM) 中文破解免激活绿色版

Internet Download Manager 6.42.3中文破解版&#xff0c;全球最佳下载利器。Internet Download Manager (简称IDM) 是一款Windows 平台功能强大的多线程下载工具&#xff0c;国外非常受欢迎。支持断点续传&#xff0c;支持嗅探视频音频&#xff0c;接管所有浏览器&#xff0c;…

【并发编程】AQS——详细解释公平锁,非公平锁,独占锁,什么是可重入以及condition

目录 1、公平 2.非公平 3.独占锁 4.可重入 5.condition 1、公平 第一步&#xff1a;获取状态的 state 的值。如果 state0 即代表锁没有被其它线程占用&#xff0c;执行第二步。如果 state!0 则代表锁正在被其它线程占用&#xff0c;执行第三步。 第二步&#xff1a;判断队列…

ICSpector:一款功能强大的微软开源工业PLC安全取证框架

关于ICSpector ICSpector是一款功能强大的开源工业PLC安全取证框架&#xff0c;该工具由微软的研究人员负责开发和维护&#xff0c;可以帮助广大研究人员轻松分析工业PLC元数据和项目文件。 ICSpector提供了方便的方式来扫描PLC并识别ICS环境中的可疑痕迹&#xff0c;可以用于…

Spring与Web环境集成

1. Spring与Web环境集成 1.1 ApplicationContext应用上下文获取方式 应用上下文对象是通过new ClasspathXmlApplicationContext(spring配置文件) 方式获取的&#xff0c;但是每次从容器中获得Bean时都要编写new ClasspathXmlApplicationContext(spring配置文件) &#xff0c;这…

RX4901CE (RTC模块)

RX4901CE是一个集成了32.768 kHz数字温度补偿晶体振荡器(DTCXO)的RTC模块。高稳定性&#xff0c;低电流消耗&#xff0c;时间戳功能&#xff0c;当外部或内部事件发生时&#xff0c;可以记录多达32个日期和时间&#xff0c;以及基本的RTC功能&#xff0c;如时间和日历&#xff…

江科大STM32 中

目录 6、TIM&#xff08;Timer&#xff09;定时器基本定时器通用定时器高级定时器示例程序&#xff08;定时器定时中断&定时器外部时钟&#xff09;TIM输出比较示例程序&#xff08;PWM驱动LED呼吸灯&PWM驱动舵机&PWM驱动直流电机&#xff09;TIM输入捕获示例程序&…

微信小程序登录获取手机号教程(超详细)

1. 背景介绍&#xff1a; 在我们开发微信小程序时&#xff0c;登录时&#xff0c;需要获取用户手机号作为唯一标识&#xff0c;下面我介绍一下获取手机号的教程。 本篇文章介绍后端获取方法&#xff1a; 前端工作 后端工作 前端 新建Page页面&#xff0c;在xxx.wxml中加入…