From eb8be78cfe1ed26b2569c45b8b607ad83a79e471 Mon Sep 17 00:00:00 2001 From: chengdandan <2549057906@qq.com> Date: Thu, 23 Mar 2023 10:29:36 +0800 Subject: [PATCH] 20230323 --- src/components/common/pieDateChart.vue | 388 ++++++------------------- 1 file changed, 96 insertions(+), 292 deletions(-) diff --git a/src/components/common/pieDateChart.vue b/src/components/common/pieDateChart.vue index c416f25..1fb6722 100644 --- a/src/components/common/pieDateChart.vue +++ b/src/components/common/pieDateChart.vue @@ -101,323 +101,127 @@ export default { initCharts() { let myChart = this.$echarts.init(this.$refs.chart); - // var placeHolderStyle = { - // normal: { - // label: { - // show: false, - // position: "center" - // }, - // labelLine: { - // show: false - // }, - // color: "#104841a3", - // borderWidth: 0 - // }, - // emphasis: { - // color: "#104841a3", - // borderColor: "#00b3ff", - // borderWidth: 0 - // } - // }; - // // 绘制图表 - // myChart.setOption({ - // series: [ - // { - // name: '值', - // type: 'pie', - // clockWise: true, - // hoverAnimation: false, - // radius: ['92%', '97%'], - // center: ['50%', '50%'], - // itemStyle: { - // normal: { - // label: { - // show: false - // }, - // labelLine: { - // show: false, - // length: 100, - // smooth: 0.5 - // }, - // borderWidth: 5, - // shadowBlur: 40, - // borderColor: "#00B3FF", - // shadowColor: 'rgba(0, 0, 0, 0)' //边框阴影 - // } - // }, - // data: [{ - // value: 12, - // }, { - // value: 4, - // name: '', - // itemStyle: placeHolderStyle - // }] - // }, - // // ------------2 - // { - // name: '值', - // type: 'pie', - // clockWise: true, - // hoverAnimation: false, - // radius: ['72%', '67%'], - // center: ['50%', '50%'], - // itemStyle: { - // normal: { - // label: { - // show: false - // }, - // labelLine: { - // show: false, - // length: 100, - // smooth: 0.5 - // }, - // borderWidth: 5, - // shadowBlur: 40, - // borderColor: "#F1E453", - // shadowColor: 'rgba(0, 0, 0, 0)' //边框阴影 - // } - // }, - // data: [{ - // value: 6, - // }, { - // value: 4, - // name: '', - // itemStyle: placeHolderStyle - // }] - // }, - // // ------------3 - // { - // name: '值', - // type: 'pie', - // clockWise: true, - // hoverAnimation: false, - // radius: ['48%', '44%'], - // center: ['50%', '50%'], - // itemStyle: { - // normal: { - // label: { - // show: false - // }, - // labelLine: { - // show: false, - // length: 100, - // smooth: 0.5 - // }, - // borderWidth: 5, - // shadowBlur: 40, - // borderColor: "#f85b60", - // shadowColor: 'rgba(0, 0, 0, 0)' //边框阴影 - // } - // }, - // data: [{ - // value: 9, - // }, { - // value: 44, - // name: '', - // itemStyle: placeHolderStyle - // }] - // }, - // ] - // }); - var data = [{ - name: "本科及以上", - value: 13211 - }, - { - name: "高中", - value: 42111 - }, - { - name: "初中及以下", - value: 81711 - }, - { - name: "其他", - value: 121711 - } -]; -function getArrayValue(array, key) { - var key = key || "value"; - var res = []; - if (array) { - array.forEach(function(t) { - res.push(t[key]); - }); - } - return res; -} -function array2obj(array,key) { - var resObj = {}; - for(var i=0;i{b}:{c}({d}%)" - }, - color: ['#FF8700', '#ffc300', '#00e473', '#009DFF'], - grid: { - top: '20%', - bottom: '48%', - left: "30%", - containLabel: false - }, - yAxis: [{ - type: 'category', - inverse: true, - axisLine: { - show: false - }, - axisTick: { - show: false - }, - axisLabel: { - interval: 0, - inside: true, - textStyle: { - color: "#000", - fontSize: 10, + labelLine: { + show: false, + length: 100, + smooth: 0.5 + }, + borderWidth: 5, + shadowBlur: 40, + borderColor: "#f85b60", + shadowColor: 'rgba(0, 0, 0, 0)' //边框阴影 + } }, - show: true - }, - data: optionData.yAxis - }], - xAxis: [{ - show: false - }], - series: optionData.series -}; + data: [{ + value: 9, + }, { + value: 44, + name: '', + itemStyle: placeHolderStyle + }] + }, + ] + }); + //默认第一条高亮 - // myChart.dispatchAction({ type: 'highlight', seriesIndex: [0, 1, 2], dataIndex: 0 }); + myChart.dispatchAction({ type: 'highlight', seriesIndex: [0, 1, 2], dataIndex: 0 }); }, }