echarts静态饼图

<div class="cake">
          <div id="cakeChart"></div>
        </div>

import * as echarts from "echarts";


  mounted() {
    this.$nextTick(() => {
   
      this.getCakeEcharts()
  
    })


  },
  methods: {
 // 饼状图
    getCakeEcharts() {
      let cakeChart = echarts.init(document.getElementById("cakeChart"));
      cakeChart.setOption({
        title: {
          left: 'center'
        },
        tooltip: {
          trigger: 'item'
        },
        legend: {
          bottom: '5%',
          left: 'center',
          textStyle: {
            color: "#fff", // 更改文本颜色
          },
        },
        color: ['#ff7f50', '#87cefa', '#da70d6', '#32cd32'], // 设置整个图表的颜色数组
        series: [
          {
            name: 'Access From',
            type: 'pie',
            radius: '50%',
            data: [
              { value: 48, name: '一级监督' },
              { value: 75, name: '二级监督' },
              { value: 80, name: '三级监督' },
              { value: 44, name: '四级监督' },
            ],
          }
        ]
      })
      window.addEventListener("resize", function () {
        cakeChart.resize();
      })
    },

}

<style>
.cake {
        width: 55%;
        height: 100%;

        #cakeChart {
          width: 100%;
          height: 100%;
        }
      }
<style>

文章来源地址https://www.uudwc.com/A/4r2GY/

原文地址:https://blog.csdn.net/xiaoming4965/article/details/132845478

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请联系站长进行投诉反馈,一经查实,立即删除!

h
上一篇 2023年09月15日 01:59
华三路由交换技术基础——计算机网络基础
下一篇 2023年09月15日 01:59