From b4b8ea5ee5861f6bccdd02c359be5bcf6a557a7a Mon Sep 17 00:00:00 2001 From: liihuu Date: Tue, 24 Dec 2024 02:09:13 +0800 Subject: [PATCH] fix: fix indicator tooltip error. --- src/view/CandleTooltipView.ts | 6 ++---- src/view/IndicatorTooltipView.ts | 3 ++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/view/CandleTooltipView.ts b/src/view/CandleTooltipView.ts index 1cda35ca3..629dcec48 100644 --- a/src/view/CandleTooltipView.ts +++ b/src/view/CandleTooltipView.ts @@ -400,20 +400,18 @@ export default class CandleTooltipView extends IndicatorTooltipView { : tooltipStyles.custom ) return legends.map(({ title, value }) => { - let t: TooltipLegendChild = { text: '', color: '' } + let t: TooltipLegendChild = { text: '', color: textColor } if (isObject(title)) { t = { ...title } } else { t.text = title - t.color = textColor } t.text = i18n(t.text, locale) - let v: TooltipLegendChild = { text: tooltipStyles.defaultValue, color: '' } + let v = { text: tooltipStyles.defaultValue, color: textColor } if (isObject(value)) { v = { ...value } } else { v.text = value - v.color = textColor } const match = /{(\S*)}/.exec(v.text) if (match !== null && match.length > 1) { diff --git a/src/view/IndicatorTooltipView.ts b/src/view/IndicatorTooltipView.ts index f08b01704..e80452ab6 100644 --- a/src/view/IndicatorTooltipView.ts +++ b/src/view/IndicatorTooltipView.ts @@ -272,8 +272,9 @@ export default class IndicatorTooltipView extends View { if (indicator.shouldFormatBigNumber) { value = customApi.formatBigNumber(value as string) } + value = decimalFold.format(thousandsSeparator.format(value as string)) } - legends.push({ title: { text: figure.title, color }, value: { text: decimalFold.format(thousandsSeparator.format((value ?? tooltipStyles.defaultValue) as string)), color } }) + legends.push({ title: { text: figure.title, color }, value: { text: (value ?? tooltipStyles.defaultValue) as string, color } }) } }) tooltipData.legends = legends