admin管理员组文章数量:1026989
I've been trying to localize default number formatting in Apache Superset charts, specifically the SI suffixes used in formats like .2s. Out of the box, Superset uses D3 defaults — k, M, B — but I need to show them in Russian: тыс., млн, млрд. What I’ve tried so far:
Changing Babel locale — partially localizes the interface, but does not affect number formatting.
Edited this file:
superset-frontend/node_modules/@superset-ui/core/src/number-format/factories/createD3NumberFormatter.ts
Injected a wrapper around .2s using .replace('k', ' тыс.'), etc.
Ran npm run build
Rebuilt with docker-compose -f docker-compose-non-dev.yml up -d --build
No effect in the UI, even on new charts
Tried registering a custom formatter in setupFormatters.ts:
getNumberFormatterRegistry().registerValue('RU_SHORT', d3Format('.2s'))
But Superset throws:
430227735890.2086 (Invalid format: RU_SHORT)
I also reviewed this article: Unfortunately, it doesn’t address SI suffix localization at all.
What I’m looking for:
Is there an official or stable way to override or localize SI suffixes in Superset?
Where is the correct hook — D3, @superset-ui/core, registry patching?
Has anyone successfully implemented localized short formats like .2s → 5 тыс., 20 млн, 8.3 млрд?
Any guidance, examples, or community experience would be appreciated
I've been trying to localize default number formatting in Apache Superset charts, specifically the SI suffixes used in formats like .2s. Out of the box, Superset uses D3 defaults — k, M, B — but I need to show them in Russian: тыс., млн, млрд. What I’ve tried so far:
Changing Babel locale — partially localizes the interface, but does not affect number formatting.
Edited this file:
superset-frontend/node_modules/@superset-ui/core/src/number-format/factories/createD3NumberFormatter.ts
Injected a wrapper around .2s using .replace('k', ' тыс.'), etc.
Ran npm run build
Rebuilt with docker-compose -f docker-compose-non-dev.yml up -d --build
No effect in the UI, even on new charts
Tried registering a custom formatter in setupFormatters.ts:
getNumberFormatterRegistry().registerValue('RU_SHORT', d3Format('.2s'))
But Superset throws:
430227735890.2086 (Invalid format: RU_SHORT)
I also reviewed this article: Unfortunately, it doesn’t address SI suffix localization at all.
What I’m looking for:
Is there an official or stable way to override or localize SI suffixes in Superset?
Where is the correct hook — D3, @superset-ui/core, registry patching?
Has anyone successfully implemented localized short formats like .2s → 5 тыс., 20 млн, 8.3 млрд?
Any guidance, examples, or community experience would be appreciated
本文标签:
版权声明:本文标题:d3.js - How to localize D3 SI suffixes in Apache Superset number formatting (e.g., k, M, B → тыс., млн, млрд)? - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1743977191a2061613.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论