dosubot[bot] commented on issue #38037:
URL: https://github.com/apache/superset/issues/38037#issuecomment-3919064445

   <!-- Greeting -->
   Hi @mandar0324! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the 
superset team.
   
   <!-- Answer -->
   Thanks for the detailed bug report! I looked into the code and found a 
likely root cause.
   
   **The issue:** When your near-zero negative values (e.g., -1 to -5) are 
formatted alongside a large outlier (-4,000,000), Superset uses the 
[SMART_NUMBER 
formatter](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset-frontend/packages/superset-ui-core/src/number-format/factories/createSmartNumberFormatter.ts#L24-L47)
 which applies SI notation. For very small values relative to the scale, this 
can produce strings like `$-1µ` or `$-100n` where the micro (µ) or nano (n) 
symbols may not render correctly in the ECharts label, leaving only the `$` 
visible.
   
   Additionally, the [stacked bar threshold 
logic](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset-frontend/plugins/plugin-chart-echarts/src/utils/series.ts#L58-L93)
 calculates percentage thresholds to filter which values display labels. With a 
massive outlier dominating the scale, your near-zero values become an extremely 
small percentage, potentially triggering edge cases.
   
   **Workaround:** Try overriding the default number format with an explicit 
d3-format string (e.g., `$,.0f` or `$,.2f`) instead of relying on the adaptive 
SMART_NUMBER format. This should prevent SI notation from being used for small 
values.
   
   There have been recent fixes in this area 
([#37039](https://github.com/apache/superset/pull/37039), 
[#36989](https://github.com/apache/superset/pull/36989)) for related currency 
formatting issues, so this may be a new edge case worth filing if the 
workaround doesn't help.
   
   
   <!-- Dosu Comment Footer -->
   *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).*
   
   ---
   <sup>How did I do? 
[Good](https://app.dosu.dev/response-feedback/b781825c-f3d4-4978-bc73-0d3a3be463fb?feedback_type=great_response)
 | 
[Irrelevant](https://app.dosu.dev/response-feedback/b781825c-f3d4-4978-bc73-0d3a3be463fb?feedback_type=irrelevant_answer)
 | 
[Incorrect](https://app.dosu.dev/response-feedback/b781825c-f3d4-4978-bc73-0d3a3be463fb?feedback_type=incorrect_sources)
 | 
[Verbose](https://app.dosu.dev/response-feedback/b781825c-f3d4-4978-bc73-0d3a3be463fb?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/b781825c-f3d4-4978-bc73-0d3a3be463fb?feedback_type=hallucination)
 | [Report 
🐛](https://app.dosu.dev/response-feedback/b781825c-f3d4-4978-bc73-0d3a3be463fb?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/b781825c-f3d4-4978-bc73-0d3a3be463fb?feedback_type=other)</sup>
   
   [![Chat with 
Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github)&nbsp;[![Open
 in 
Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=Thanks%20for%20the%20detailed%20bug%20report%21%20I%20looked%20into%20the%20code%20and%20found%20a%20likely%20root%20cause.%0A%0A%2A%2AThe%20issue%3A%2A%2A%20When%20your%20near-zero%20negative%20values%20%28e.g.%2C%20-1%20to%20-5%29%20are%20formatted%20alongside%20a%20large%20outlier%20%28-4%2C000%2C000%29%2C%20Superset%20uses%20the%20%5BSMART_NUMBER%20formatter%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset-frontend/packages/superset-ui-core/src/number-format/factories/createSmartNumberFormatter.ts%23L24-L47%29%20which%20applies%20SI%20notation.%20For%20very%20small%20values%20relative%20to%20the%20scale%2C%20this%20can%20produce%20strings%20like%20%60%24-1%C2%B5%60%20or%20%60%24-100n%60%20where%20
 
the%20micro%20%28%C2%B5%29%20or%20nano%20%28n%29%20symbols%20may%20not%20render%20correctly%20in%20the%20ECharts%20label%2C%20leaving%20only%20the%20%60%24%60%20visible.%0A%0AAdditionally%2C%20the%20%5Bstacked%20bar%20threshold%20logic%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset-frontend/plugins/plugin-chart-echarts/src/utils/series.ts%23L58-L93%29%20calculates%20percentage%20thresholds%20to%20filter%20which%20values%20display%20labels.%20With%20a%20massive%20outlier%20dominating%20the%20scale%2C%20your%20near-zero%20values%20become%20an%20extremely%20small%20percentage%2C%20potentially%20triggering%20edge%20cases.%0A%0A%2A%2AWorkaround%3A%2A%2A%20Try%20overriding%20the%20default%20number%20format%20with%20an%20explicit%20d3-format%20string%20%28e.g.%2C%20%60%24%2C.0f%60%20or%20%60%24%2C.2f%60%29%20instead%20of%20relying%20on%20the%20adaptive%20SMART_NUMBER%20format.%20This%20should%20prevent%20SI%20notation%20from%20being%20used%
 
20for%20small%20values.%0A%0AThere%20have%20been%20recent%20fixes%20in%20this%20area%20%28%5B%2337039%5D%28https%3A//github.com/apache/superset/pull/37039%29%2C%20%5B%2336989%5D%28https%3A//github.com/apache/superset/pull/36989%29%29%20for%20related%20currency%20formatting%20issues%2C%20so%20this%20may%20be%20a%20new%20edge%20case%20worth%20filing%20if%20the%20workaround%20doesn%27t%20help.)&nbsp;[![Join
 
Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share
 on 
X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/issues/38037)


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to