| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- <template>
- <el-row >
- <div
- id="index1"
- style="width:360px;height:360px;margin:-78px 0 0 134px;"
- ></div>
- </el-row>
- </template>
- <script>
- import * as echarts from 'echarts';
- export default {
- props: ["resData"],
- data() {
- return {
- data:[]
- };
- },
- watch: {
- resData(val,old){
- this.data = val
- this.getData()
- }
- },
- methods: {
- getData() {
- let myChart = echarts.init(document.getElementById("index1"));
- let option = {
- color: [
- '#F8B13D',
- 'rgba(46,52,64,1)',
- ],
- title: {
- //text: data.attendeeIsSign,
- text: this.data[0].value + '%',
- textStyle: {
- color: '#E6EFFF',
- fontSize: 25
- },
- subtext: '使用率',
- subtextStyle: {
- color: '#E6EFFF',
- fontSize: 20
- },
- itemGap: 10, // 主副标题距离
- left: 'center',
- top: '42%'
- },
- tooltip: {
- trigger: 'item'
- },
- legend: {
- top: '70%',
- left: 'center',
- textStyle: {
- color: "#FFF"
- }
- },
- series: [
- {
- name: '',
- type: 'pie',
- radius: ['30%', '35%'],
- avoidLabelOverlap: false,
- label: {
- show: false,
- position: 'center'
- },
- emphasis: {
- // label: {
- // show: true,
- // fontSize: '40',
- // fontWeight: 'bold'
- // }
- },
- labelLine: {
- show: false
- },
- data: this.data
- }
- ]
- };
- myChart.setOption(option);
- option && myChart.setOption(option);
- setTimeout(function () {
- window.onresize = function () {
- myChart.resize();
- };
- }, 200);
- },
- },
- };
- </script>
|