dosubot[bot] commented on issue #32698: URL: https://github.com/apache/superset/issues/32698#issuecomment-2728966940
<!-- Answer --> I couldn't find specific information on defining custom number formats via `config.py` in the Superset repository. However, Superset does integrate D3 formatting for numbers using the `createD3NumberFormatter` function. This involves specifying a `formatString` in the configuration object, which is used as the ID for the formatter and determines the formatting style using D3's format function <sup>[[1]](https://github.com/apache/superset/blob/master/superset-frontend/packages/superset-ui-core/test/number-format/factories/createD3NumberFormatter.test.ts)</sup>. For custom number formats, you might want to explore using the `NumberFormatterRegistry` in Superset, which allows you to register and retrieve custom formatters. You can create a formatter with a valid D3 format string and handle invalid format strings by displaying an error message and setting `isInvalid` to true <sup>[[2]](https://github.com/apache/superset/blob/master/superset-frontend/packages/superset-ui-core/test/number-format/NumberFormatterRegistrySingleton.test.ts)</sup>. If you are trying to set locale-specific formats, you can customize locale settings using the `locale` property in the formatter configuration. This includes settings for decimal, thousands, grouping, and currency symbols <sup>[[3]](https://github.com/apache/superset/blob/master/superset-frontend/packages/superset-ui-chart-controls/src/utils/D3Formatting.ts)</sup>. For more detailed examples, you can refer to the tests and examples in the Superset codebase, such as those found in `createD3NumberFormatter.test.ts` and `NumberFormat.stories.tsx` <sup>[[4]](https://github.com/apache/superset/blob/master/superset-frontend/packages/superset-ui-core/test/number-format/factories/createSmartNumberFormatter.test.ts)</sup><sup>[[5]](https://github.com/apache/superset/blob/master/superset-frontend/packages/superset-ui-demo/storybook/stories/superset-ui-number-format/NumberFormat.stories.tsx)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/b1429fd4-9820-46e7-8b6f-42cfa0bb9ade?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/b1429fd4-9820-46e7-8b6f-42cfa0bb9ade?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/b1429fd4-9820-46e7-8b6f-42cfa0bb9ade?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/b1429fd4-9820-46e7-8b6f-42cfa0bb9ade?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/b1429fd4-9820-46e7-8b6f-42cfa0bb9ade?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/b1429fd4-9820-46e7-8b6f-42cfa0bb9ade?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/b1429fd4-9820-46e7-8b6f-42cfa0bb9ade?feedback_type=other)</sup> -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For additional commands, e-mail: notifications-h...@superset.apache.org