Skip to content

fix: use axis number formatter for values over points - #434

Open
kaulith wants to merge 1 commit into
frappe:v2-betafrom
kaulith:fix/values-over-points-number-formatter
Open

fix: use axis number formatter for values over points#434
kaulith wants to merge 1 commit into
frappe:v2-betafrom
kaulith:fix/values-over-points-number-formatter

Conversation

@kaulith

@kaulith kaulith commented Aug 27, 2026

Copy link
Copy Markdown

Y-axis labels honour axisOptions.numberFormatter, but the values drawn over bars do not; they call shortenLargeNumber directly, which has a hardcoded K/M/B/T suffix table. On any chart that passes a formatter, the two disagree.

Frappe hits this on every dashboard chart with "Show Values Over Chart" enabled on an Indian-locale site. frappe.utils.make_chart passes a formatter that returns the Indian number system, so the axis reads 6 Cr while the bar labels on the same chart read 56M. Same numbers, two unit systems, one chart.

Routing the value labels through the configured formatter fixes it. The stacked branch is folded into the same path; it was passing cumulativeYs through unformatted, so stacked totals printed in full while the axis was shortened. Charts that pass no formatter keep the existing shortenLargeNumber output, so nothing changes for anyone not setting one.

@kaulith

kaulith commented Aug 27, 2026

Copy link
Copy Markdown
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant