We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
value
1.22.0
Vite
tooltip.valueFormatter is not called when the value argument is falsey. This is an issue when value is 0.
tooltip.valueFormatter
Say we want to add "units" to all y-values in our tooltip:
valueFormatter: (value, label) => { if (label === 'y-value') { return value + ' units'; } }
We will only see "units" added to non-falsey values:
I believe the issue is being caused by this condition:
carbon-charts/packages/core/src/components/essentials/tooltip.ts
Line 169 in d602884
// options { title: 'Vertical simple bar (discrete)', axes: { left: { mapsTo: 'value', }, bottom: { mapsTo: 'group', scaleType: 'labels', }, }, height: '400px', tooltip: { // when value is 0, `valueFormatter` isn't executed valueFormatter: (value, label) => { if (label === 'y-value') { return value + ' units'; } }, }, }; // data [ { group: 'Qty', value: 0 }, { group: 'More', value: 29123 }, { group: 'Sold', value: 35213 }, { group: 'Restocking', value: 51213 }, { group: 'Misc', value: 16932 } ]
https://stackblitz.com/edit/juzzbq?file=options.js,data.js
No response
P3 (Low)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Relevant package(s)
Carbon Charts Version
1.22.0
Which bundler are you using?
Vite
What happened and what did you expect to happen?
tooltip.valueFormatter
is not called when thevalue
argument is falsey. This is an issue whenvalue
is 0.Say we want to add "units" to all y-values in our tooltip:
We will only see "units" added to non-falsey values:
I believe the issue is being caused by this condition:
carbon-charts/packages/core/src/components/essentials/tooltip.ts
Line 169 in d602884
Chart data and options (automatically formatted so no need for backticks)
JavaScript console or build output (if relevant)
StackBlitz repro
https://stackblitz.com/edit/juzzbq?file=options.js,data.js
IBM Application/Team (if relevant)
No response
What priority level would this be in your opinion?
P3 (Low)
The text was updated successfully, but these errors were encountered: