From e837000d8b6ba07b68f6b0a00bf566ea8163b188 Mon Sep 17 00:00:00 2001 From: hejianhao <15708179461@qq.com> Date: 星期一, 24 三月 2025 17:34:22 +0800 Subject: [PATCH] 哥季度应补偿总额 --- src/components/datascreen/RightPanel.vue | 53 +++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 39 insertions(+), 14 deletions(-) diff --git a/src/components/datascreen/RightPanel.vue b/src/components/datascreen/RightPanel.vue index 21332ac..fc446ce 100644 --- a/src/components/datascreen/RightPanel.vue +++ b/src/components/datascreen/RightPanel.vue @@ -112,17 +112,28 @@ this.barOption = { tooltip: { trigger: 'axis', - formatter: function (params) { + formatter: function(params) { const dataParams = params[1]; - return `${dataParams.name}<br/>数值:${dataParams.value}`; + // 获取当前柱子的颜色(取渐变色的起始色) + let color; + if (dataParams.dataIndex === 0) { + color = '#FFEF00'; + } else if (dataParams.dataIndex === 1) { + color = '#00FFC3'; + } else if (dataParams.dataIndex === 2) { + color = '#00DBFF'; + } else { + color = '#057BFF'; + } + return `${dataParams.name}<br/><span style="display:inline-block;width:8px;height:8px;border-radius:50%;background-color:${color};margin-right:6px;"></span>${dataParams.value}`; }, - backgroundColor: 'rgba(0,0,0,0.7)', - borderColor: '#00ffff', + backgroundColor: '#ffffff', borderWidth: 1, textStyle: { - color: '#fff', + color: '#333333', fontSize: 14 - } + }, + padding: [8, 12] }, grid: { top: '10%', @@ -134,13 +145,13 @@ xAxis: { type: 'category', data: sortedData.map(item => item[0]), - axisTick: { - show: false // 隐藏刻度线 - }, axisLine: { lineStyle: { color: 'rgba(30, 44, 88, 1)' } + }, + axisTick: { + show: false }, axisLabel: { color: '#ffffff', @@ -182,12 +193,26 @@ symbolOffset: [0, 0], symbolBoundingData: yAxisMax, z: 2, - data: sortedData.map(item => item[1]), - itemStyle: { - color: function (params) { - return params.dataIndex === 0 ? '#ffd700' : '#00ffff'; + data: sortedData.map((item, index) => ({ + value: item[1], + itemStyle: { + color: index === 0 ? new this.$echarts.graphic.LinearGradient(0, 0, 0, 1, [ + { offset: 0, color: '#FFEF00' }, + { offset: 0.5, color: '#C86A01' }, + { offset: 1, color: '#402303' } + ]) : index === 1 ? new this.$echarts.graphic.LinearGradient(0, 0, 0, 1, [ + { offset: 0, color: '#00FFC3' }, + { offset: 1, color: '#008570' } + ]) : index === 2 ? new this.$echarts.graphic.LinearGradient(0, 0, 0, 1, [ + { offset: 0, color: '#00DBFF' }, + { offset: 1, color: '#0093A8' } + ]) : new this.$echarts.graphic.LinearGradient(0, 0, 0, 1, [ + { offset: 0, color: '#05DBFF' }, + { offset: 0.5, color: '#057BFF' }, + { offset: 1, color: '#030E3F' } + ]) } - } + })) } ] }; -- Gitblit v1.7.1