From 14e73128bfa02922fdcf9591ee6d5fd6b6f7a5c6 Mon Sep 17 00:00:00 2001 From: Mr.Zhang <710666463@qq.com> Date: 星期二, 22 八月 2023 10:25:26 +0800 Subject: [PATCH] 不良品饼图 --- screen_standard/src/views/process.vue | 174 +++++++++++++++++++++++++++++++++++---------------------- 1 files changed, 106 insertions(+), 68 deletions(-) diff --git a/screen_standard/src/views/process.vue b/screen_standard/src/views/process.vue index fb6fe3e..378946b 100644 --- a/screen_standard/src/views/process.vue +++ b/screen_standard/src/views/process.vue @@ -141,6 +141,14 @@ { date: '8/6', num: '10' }, { date: '8/7', num: '20' }, ]) +let typeDistribution = reactive([ + { name: '澶栬涓嶈壇', num: 15 }, + { name: '鏈夋瘺鍒�', num: 12 }, + { name: '灏哄涓嶈壇', num: 22 }, + { name: '鏈夊垝鐥�', num: 5 }, + { name: '鍏朵粬', num: 2 }, + +]) // start() onBeforeUnmount(() => { clearTimeout(planTimer.value) @@ -148,9 +156,10 @@ }) onMounted(() => { nextTick(() => { - // start() - // reportStart() + start() + reportStart() setDayChart() + setTypeChart() }) }) @@ -241,13 +250,15 @@ } } } -/** */ +/** + * 涓冩棩鎶樼嚎鍥� + */ function setDayChart() { let dayChartDom = document.getElementById('day-distribution'); let myChart = echarts.init(dayChartDom); let dateList = [] let numList = [] - + dayDistribution.forEach(item => { dateList.push(item.date) numList.push(item.num) @@ -277,7 +288,7 @@ }, data: dateList }, - + yAxis: { type: 'value', splitLine: { @@ -326,69 +337,94 @@ textStyle: { color: '#fff' } - }, - // xAxis: { - // type: 'category', - // boundaryGap: false, - // axisLabel: { - // textStyle: { - // color: '#fff' - // } - // }, - // axisLine: { - // lineStyle: { - // color: '#fff' - // } - // } - // }, - // yAxis: { - // type: 'value', - // boundaryGap: [0, '30%'], - // splitLine: { - // lineStyle: { - // width: 0.5, - // color: ['#fff'] - // } - // }, - // axisLabel: { - // textStyle: { - // color: '#fff' - // } - // } - // }, - // visualMap: { - // type: 'piecewise', - // show: false, - // dimension: 0, - // seriesIndex: 0, - - // }, - // series: [ - // { - // type: 'line', - // smooth: 0.6, - // symbol: 'none', - // lineStyle: { - // color: '#03D2B5', - // width: 1 - // }, - // areaStyle: { - // color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ - // { - // offset: 0, - // color: 'rgba(3, 210, 181, .9)', - // }, - // { - // offset: 1, - // color: 'rgba(3, 210, 181, 0)', - // } - // ]) - // }, - // data: dateList - // } - // ] + } } + option && myChart.setOption(option); +} +/** + * 涓嶈壇绫诲瀷鍒嗗竷 + */ +function setTypeChart() { + let dayChartDom = document.getElementById('type-distribution'); + let myChart = echarts.init(dayChartDom); + let legendData = [] + let seriesData = [] + typeDistribution.forEach(item => { + legendData.push(item.name) + seriesData.push({name:item.name, value:item.num}) + }) + let option = { + // title: { + // text: '鍚屽悕鏁伴噺缁熻', + // subtext: '绾睘铏氭瀯', + // left: 'center' + // }, + // tooltip: { + // trigger: 'item', + // formatter: '{a} <br/>{b} : {c} ({d}%)' + // }, + legend: { + show: false, + type: 'scroll', + orient: 'vertical', + right: 10, + top: 20, + bottom: 20, + data: legendData + }, + series: [ + { + // name: '濮撳悕', + type: 'pie', + + radius: ['60%', '70%'], + // avoidLabelOverlap: false, + itemStyle: { + borderRadius: 4, + borderColor: 'rgba(52, 88, 159, 0.4)', + borderWidth: 4 + }, + center: ['50%', '50%'], + labelLine: { + show: false + }, + label: { + formatter:'{dot| } {title|{b} {c}}\n\n{per|{d}%}', + rich: { + title: { + color: '#fff' + }, + per: { + color: '#01D9FE' + }, + dot: { + backgroundColor: 'inherit', + width: 8, + height: 8, + borderRadius: 4 + } + } + }, + // labelLayout: { + // hideOverlap: true + // }, + endLabel: { + show: true, + distance: 5, + color: "red" + }, + data: seriesData, + emphasis: { + itemStyle: { + shadowBlur: 10, + shadowOffsetX: 0, + shadowColor: 'rgba(0, 0, 0, 1)' + } + } + } + ] + } option && myChart.setOption(option); } </script> @@ -525,15 +561,18 @@ .bad-diagram { height: 222px; background: linear-gradient(180deg, rgba(52, 88, 159, 0) 0%, rgba(0, 86, 255, 0.4) 100%); + .bad-content { display: flex; margin-top: 20px; + #day-distribution { // padding: 20px; box-sizing: border-box; flex: 0.5; height: 190px; } + #type-distribution { flex: 0.4; } @@ -609,5 +648,4 @@ } } } -} -</style> \ No newline at end of file +}</style> \ No newline at end of file -- Gitblit v1.9.3