fluentui
fluentui copied to clipboard
[Bug]: Line Charts tooltips shows Zero as the value if the values are very low
Library
React / v8 (@fluentui/react)
System Info
System:
OS: Windows 11 10.0.22621
CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz
Memory: 25.09 GB / 47.71 GB
Browsers:
Edge: Chromium (119.0.2151.58)
Internet Explorer: 11.0.22621.1
Are you reporting Accessibility issue?
no
Reproduction
https://codepen.io/sobera/pen/JjxvymY
Bug Description
Actual Behavior
When values on a line chart are really low (< zero) the callouts show "Zero" as the values
https://codepen.io/sobera/pen/JjxvymY
Expected Behavior
They should show the exact value
Logs
No response
Requested priority
High
Products/sites affected
No response
Are you willing to submit a PR to fix?
no
Validations
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] The provided reproduction is a minimal reproducible example of the bug.
Thanks for reporting this issue. Currently the charting library uses the toLocaleString function to show the number in callout https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toLocaleString By default the number is rounded off to 2 decimal points resulting in a 0 for your use case. We support parameterizing the culture but not the Intl.NumberFormat() options.
To solve this, you can explicitly format the number using d3 formatting options as demoed in the codepen link below and passing an additional yAxisCalloutData property to the data. https://codepen.io/AtishayMsft/pen/WNPJyWN
Thank you @AtishayMsft the workaround works, but our customers are not comfortable with the "micron" notation. I will still try to go with this, but please provide a way to not round off the callout data
@soberams We have added this ask to our backlog. We will plan it in the upcoming sprints.
keep open
This issue has not had activity for over 180 days! We're adding Soft close label and will close it soon for house-keeping purposes. Still require assistance? Please add comment - "keep open".
This issue has not had activity for over 180 days! We're adding Soft close label and will close it soon for house-keeping purposes. Still require assistance? Please add comment - "keep open".