当前位置:   article > 正文

Echarts双环饼状图_echarts 双饼图

echarts 双饼图

Echarts双环饼状图
Echarts官网:https://www.echartsjs.com/examples/zh/index.html
在这里插入图片描述

<template>
  <div :id="id" :style="chartSize" ref="chart"></div>
</template>
<script>
// eslint-disable-next-line
/* eslint-disable */
import echarts from "echarts";
export default {
  name: "hzyhChart",
  props: {
    className: {
      type: String,
      default: "chart"
    },
    id: {
      type: String
    },
    width: {
      type: String,
      default: "100%"
    },
    height: {
      type: String,
      default: "400px"
    },
     tzhyList:{
    },
    
  },
  data() {
      
    return {
      chartSize: {},
    };
  },
  created() {
    this.chartSize = {
      width: this.width,
      height: this.height
    };
  },
  mounted() {
    this.initChart();
  },
  methods: {
    initChart() {
    //   this.chart = echarts.init(document.getElementById(this.id));
      this.chart = echarts.init(this.$refs.chart);
      let option = {
          tooltip: {
              trigger: 'item',
              formatter: "{a} <br/>{b}: {c} ({d}%)"
          },
          legend: {
              orient: 'vertical', //horizontal 
              // backgroundColor:'#fff',
              color: '#fff',
              //bottom: '0%',
              x: 'right',
              data: ['data1', 'data2', 'data3']
          },
          series: [
              //内圈
              {
                  name: '单位数',
                  type: 'pie',
                  roseType: 'area', //area比例缩放 ,radius
                  radius: ['20%', '40%'],
                  center: ['50%', '55%'], //位置
                  color: [ '#078686', '#00d0d0', '#034079', '#6f81da', '#00ffb4'],
                  avoidLabelOverlap: false,
                  label: {
                      normal: {
                          show: true,
                          position: 'inner', //center 
                          formatter: '{d}%', //{d} 
                          textStyle: {
                              color: '#fff',
                              fontWeight: 'bold',
                              fontSize: 14
                          }
                      },
                      emphasis: {
                          show: true,
                          textStyle: {
                              fontSize: '30',
                              fontWeight: 'bold'
                          }
                      }
                  },
                  labelLine: {
                      normal: {
                          show: false
                      }
                  },

                  data: [{
                      value: 11100,
                      name: '物业服务'
                  }, {
                      value: 2220,
                      name: '机关团体'
                  }, {
                      value: 3303,
                      name: '事业单位'
                  }, {
                      value: 4404,
                      name: '企业单位'
                  }]
              }, //外圈
              {
                  name: '人员数',
                  type: 'pie',
                  radius: ['50%', '80%'], 
                  avoidLabelOverlap: false,
                  label: {
                      normal: {
                          show: true,
                          position: 'inner', //center  
                          formatter: function(param) {
                              return param.name + ':\n' + Math.round(param.percent) + '%';
                          },
                          textStyle: {
                              color: '#fff',
                              fontWeight: 'bold',
                              fontSize: 14
                          }
                      },

                      emphasis: {
                          show: false,
                      }
                  },
                  labelLine: {
                      normal: {
                          smooth: true,
                          lineStyle: {
                              width: 2
                          }
                      }
                  },
                  itemStyle: {
                      normal: {
                          shadowBlur: 30,
                          shadowColor: 'rgba(0, 0, 0, 0.4)'
                      }
                  },

                  data: [{
                      value: 21321,
                      name: '物业服务'
                  }, {
                      value: 1212,
                      name: '机关团体'
                  }, {
                      value: 121,
                      name: '事业单位'
                  }, {
                      value: 1212,
                      name: '企业单位'
                  }]
              }
              
          ]
      };
      this.chart.setOption(option);
    }
  }
};
</script>
<style scoped>
div {
  margin: 0 auto;
}
</style>

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175
  • 176
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/天景科技苑/article/detail/769652
推荐阅读
相关标签
  

闽ICP备14008679号