From cd8c3b155e689f27433e2ab834341a7bb20c0932 Mon Sep 17 00:00:00 2001 From: jianneng-fit2cloud Date: Thu, 26 Sep 2024 00:17:16 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E8=A7=86=E5=9B=BE):=20=E4=BF=AE=E5=A4=8DK?= =?UTF-8?q?=E7=BA=BF=E5=9B=BE=E8=87=AA=E5=AE=9A=E4=B9=89=E9=A2=9C=E8=89=B2?= =?UTF-8?q?=E5=88=86=E7=B1=BB=E4=B8=8D=E6=AD=A3=E7=A1=AE=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/frontend/src/views/chart/chart/bar/bar_antv.js | 4 +++- core/frontend/src/views/chart/chart/util.js | 9 +++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/core/frontend/src/views/chart/chart/bar/bar_antv.js b/core/frontend/src/views/chart/chart/bar/bar_antv.js index 809d81e0f4..d9010fc981 100644 --- a/core/frontend/src/views/chart/chart/bar/bar_antv.js +++ b/core/frontend/src/views/chart/chart/bar/bar_antv.js @@ -608,11 +608,13 @@ export function stockLineOptionAntV(container, chart, action) { const theme = getTheme(chart) const legend = getLegend(chart) const basicStyle = JSON.parse(chart.customAttr).color - const colors = [] + let colors = [] const alpha = basicStyle.alpha basicStyle.colors.forEach(ele => { colors.push(hexColorToRGBA(ele, alpha)) }) + // custom color + colors = antVCustomColor(chart) const data = cloneDeep(chart.data?.tableRow ?? []) // 时间字段 diff --git a/core/frontend/src/views/chart/chart/util.js b/core/frontend/src/views/chart/chart/util.js index 340459a379..c14c5b5306 100644 --- a/core/frontend/src/views/chart/chart/util.js +++ b/core/frontend/src/views/chart/chart/util.js @@ -3761,6 +3761,15 @@ export function getColors(chart, colors, reset) { }) } } + } else if (equalsAny(chart.type, 'stock-line')) { + const averages = ['MA5', 'MA10', 'MA20', 'MA60', 'MA120', 'MA180'] + for (let i = 0; i < averages.length; i++) { + seriesColors.push({ + name: averages[i], + color: colors[i % colors.length], + isCustom: false + }) + } } else { if (chart.data) { const data = chart.data.data