From 90c1f095c0747ba5f4f331856955c8307b502dc3 Mon Sep 17 00:00:00 2001 From: ulleo Date: Wed, 31 Jan 2024 13:29:16 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E5=9B=BE=E8=A1=A8):=20=E6=8C=87=E6=A0=87?= =?UTF-8?q?=E5=8D=A1=E5=AD=97=E4=BD=93=E9=A2=9C=E8=89=B2=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E8=B7=9F=E9=9A=8F=E9=85=8D=E8=89=B2=E6=96=B9=E6=A1=88=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../indicator/DeIndicator.vue | 28 ++++++++++++++-- .../editor/editor-style/ChartStyle.vue | 19 +++++++++-- .../components/IndicatorNameSelector.vue | 28 ++++++++++++++-- .../components/IndicatorValueSelector.vue | 33 +++++++++++++++++-- .../views/chart/components/editor/index.vue | 20 ++++++++--- .../chart/components/editor/util/chart.ts | 6 ++-- 6 files changed, 116 insertions(+), 18 deletions(-) diff --git a/core/core-frontend/src/custom-component/indicator/DeIndicator.vue b/core/core-frontend/src/custom-component/indicator/DeIndicator.vue index 4242a34d4b..5b37c41ced 100644 --- a/core/core-frontend/src/custom-component/indicator/DeIndicator.vue +++ b/core/core-frontend/src/custom-component/indicator/DeIndicator.vue @@ -12,6 +12,7 @@ import { DEFAULT_INDICATOR_STYLE } from '@/views/chart/components/editor/util/chart' import { valueFormatter } from '@/views/chart/components/js/formatter' +import { hexColorToRGBA } from '@/views/chart/components/js/util' const props = defineProps({ view: { @@ -222,15 +223,21 @@ const renderChart = async view => { if (!view) { return } + + const TEMP_DEFAULT_CHART = cloneDeep(BASE_VIEW_CONFIG) + delete TEMP_DEFAULT_CHART.customAttr.basicStyle.alpha + const chart = deepCopy({ - ...defaultsDeep(view, cloneDeep(BASE_VIEW_CONFIG)), + ...defaultsDeep(view, TEMP_DEFAULT_CHART), data: chartData.value }) + recursionTransObj(customAttrTrans, chart.customAttr, scale.value, terminal.value) recursionTransObj(customStyleTrans, chart.customStyle, scale.value, terminal.value) if (chart.customAttr) { const customAttr = chart.customAttr + if (customAttr.indicator) { switch (customAttr.indicator.hPosition) { case 'left': @@ -254,6 +261,15 @@ const renderChart = async view => { } indicatorColor.value = customAttr.indicator.color + let suffixColor = customAttr.indicator.suffixColor + + if (customAttr.basicStyle && customAttr.basicStyle.alpha !== undefined) { + indicatorColor.value = hexColorToRGBA( + customAttr.basicStyle.colors[0], + customAttr.basicStyle.alpha + ) + suffixColor = hexColorToRGBA(customAttr.basicStyle.colors[1], customAttr.basicStyle.alpha) + } indicatorClass.value = { color: thresholdColor.value, @@ -270,7 +286,7 @@ const renderChart = async view => { } indicatorSuffixClass.value = { - color: customAttr.indicator.suffixColor, + color: suffixColor, 'font-size': customAttr.indicator.suffixFontSize + 'px', 'font-family': defaultTo( CHART_CONT_FAMILY_MAP[customAttr.indicator.suffixFontFamily], @@ -287,9 +303,15 @@ const renderChart = async view => { suffixContent.value = defaultTo(customAttr.indicator.suffix, '') } if (customAttr.indicatorName && customAttr.indicatorName.show) { + let nameColor = customAttr.indicatorName.color + + if (customAttr.basicStyle && customAttr.basicStyle.alpha !== undefined) { + nameColor = hexColorToRGBA(customAttr.basicStyle.colors[2], customAttr.basicStyle.alpha) + } + indicatorNameShow.value = true indicatorNameClass.value = { - color: customAttr.indicatorName.color, + color: nameColor, 'font-size': customAttr.indicatorName.fontSize + 'px', 'font-family': defaultTo( CHART_CONT_FAMILY_MAP[customAttr.indicatorName.fontFamily], diff --git a/core/core-frontend/src/views/chart/components/editor/editor-style/ChartStyle.vue b/core/core-frontend/src/views/chart/components/editor/editor-style/ChartStyle.vue index 54707fee91..956efabf42 100644 --- a/core/core-frontend/src/views/chart/components/editor/editor-style/ChartStyle.vue +++ b/core/core-frontend/src/views/chart/components/editor/editor-style/ChartStyle.vue @@ -1,6 +1,6 @@