Skip to content

Commit

Permalink
fix: fix indicator tooltip error.
Browse files Browse the repository at this point in the history
  • Loading branch information
liihuu committed Dec 23, 2024
1 parent 73fcf34 commit b4b8ea5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
6 changes: 2 additions & 4 deletions src/view/CandleTooltipView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion src/view/IndicatorTooltipView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,9 @@ export default class IndicatorTooltipView extends View<YAxis> {
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
Expand Down

0 comments on commit b4b8ea5

Please sign in to comment.