[@mantine/charts] BarChart: added waterfall type #6231
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is related to #6224
Enhancement to ChartTooltip.tsx: Support for number[] in valueFormatter
This pull request introduces support for an array of numbers (number[]) as input to the valueFormatter property in ChartTooltip.tsx. Previously, valueFormatter was strictly typed as (value: number) => string. However, the Recharts documentation indicates that both bar and area charts may utilize an array of numbers as input (see: AreaChart API and BarChart API).
Modifying the valueFormatter type globally would impact other charts adversely. Therefore, I have refrained from altering the type but have extended the functionality in ChartTooltip.tsx to accommodate a tuple of two numbers, which is essential for the waterfall chart implementation. This update ensures compatibility without affecting existing chart functionalities.
Enhancement to
ChartLegend.tsx
Accepts now a showColor prop to turn on and of the ColorSwatch (true) by default
Review questions
Please check that the special keys
color
andstandalone
are semantically okay for you to use as a data input.color
: beside of the series adds the functionality to change the color of a single Bar.standalone
: Only used for waterfall if you want to render a Bar which does not depend on the previous one.