From d78837d0b3c4303bd7817ef6a97f865b770d4ab3 Mon Sep 17 00:00:00 2001 From: Lxy Date: Tue, 24 Feb 2026 01:08:53 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20k=E7=BA=BF=E5=9B=BE=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E6=AD=A3=E7=A1=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/data/futures_analysis.db | Bin 11218944 -> 11218944 bytes src/pages/detail/Detail.jsx | 93 +++++++++++++++--- 2 files changed, 78 insertions(+), 15 deletions(-) diff --git a/backend/service_implementation/service/data/futures_analysis.db b/backend/service_implementation/service/data/futures_analysis.db index c6450c5f5fd0d77340018c3347cc7c37a1e8f167..345c9a20c2aab3eb94d284db149829d6c279aca8 100644 GIT binary patch delta 780 zcmZwBMN`!Q7=`hBt;YZMojw@Zc z_7gbP41+T+-gk3;bLNzNeciO|*H!im)mNpD3)R;am*k}^`d0lpFFW+H0trcqq)HQM zDrpjyX3|_*NK0uYt)-2$m3GozI!H(9B%P&;bd_$>U3y4QNtX=iCA}q6`bb~Nl77-( zvSok_ltD6BhR9IKkzC1>Uwa}FNWK)vFo{Y`;*yZ043`lyQbx&WDU>lXR>sMAnIIEo zl1!EIVb1kf?SkKQYlq(S*qoVT$O85BiH4I+>~2#TkgnRxhMDKfjpE)@>rh8Q+X!O z<;7cGHu;{KmG-G7ocU^Wv+(`!@^Fu|Pj$6#O235a-n}V(-{`jpr52Vitf{?RoIapn zK9MBxWRS>BM1mk54+x?;1UW%|W+e7EDJ);`2WL0J@mM5CME{FxJ`^P~eixH0C`jfH n%T2^$k!aA^M*k*-Ij?zgwOBd-X-K4wpke<>@dP^VaEB&OuWV`H;ow7@I%O2S) z`((cykb`na4$BcaD#zrwoRE`JBd6rFoRPC~PR`2(iAzFirA{u&CAloh6}c+c0g}jtk@><@=TX`q%<%4|u!l&Fn v!Tj*=WVj$znn^due+4q%n&aR9b23}1f@QVU$#i2ZlKfhf3T48@slVZW0F&Da diff --git a/src/pages/detail/Detail.jsx b/src/pages/detail/Detail.jsx index 02a1435..f04095f 100644 --- a/src/pages/detail/Detail.jsx +++ b/src/pages/detail/Detail.jsx @@ -120,6 +120,18 @@ const Detail = () => { ]); } + // 准备成交量数据 + const volumeData = klineData.map(item => { + const isUp = item.close >= item.open; + return [ + new Date(item.timestamp * 1000).getTime(), // 时间戳 + item.volume, // 成交量 + isUp ? 1 : 0 // 涨跌状态,用于着色 + ]; + }); + + console.log('Volume data for ECharts:', volumeData); + // 配置选项 const option = { tooltip: { @@ -129,22 +141,60 @@ const Detail = () => { } }, legend: { - data: ['K线', 'MA5', 'MA10'] - }, - grid: { - left: '3%', - right: '4%', - bottom: '3%', - containLabel: true - }, - xAxis: { - type: 'time', - boundaryGap: false - }, - yAxis: { - type: 'value', - scale: true + data: ['K线', 'MA5', 'MA10', '成交量'], + top: '3%', + left: 'center' }, + grid: [ + { + left: '3%', + right: '4%', + bottom: '15%', + containLabel: true + }, + { + left: '3%', + right: '4%', + bottom: '3%', + height: '10%', + containLabel: true + } + ], + xAxis: [ + { + type: 'time', + boundaryGap: false, + axisLabel: { + show: true + } + }, + { + type: 'time', + boundaryGap: false, + gridIndex: 1, + axisLabel: { + show: false + } + } + ], + yAxis: [ + { + type: 'value', + scale: true, + splitArea: { + show: true + } + }, + { + type: 'value', + scale: true, + gridIndex: 1, + splitNumber: 2, + axisLabel: { + show: true + } + } + ], series: [ { name: 'K线', @@ -178,6 +228,19 @@ const Detail = () => { color: '#faad14' }, showSymbol: false + }, + { + name: '成交量', + type: 'bar', + xAxisIndex: 1, + yAxisIndex: 1, + data: volumeData, + itemStyle: { + color: function(params) { + // 根据涨跌状态着色 + return params.data[2] === 1 ? '#52c41a' : '#ff4d4f'; + } + } } ] };