New issue
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
Chart legend not displaying values when they are nested #5885
Comments
I created these two functions to update the payload for both the // ChartTooltip.tsx
function updateChartTooltipPayload(payload: Record<string, any>[]) : Record<string, any>[] {
return payload.map((item) => {
const newDataKey = item.name.split('.').pop();
return {
...item,
name: newDataKey,
};
});
}
// ChartLegend.tsx
function updateChartLegendPayload(payload: Record<string, any>[]) : Record<string, any>[] {
return payload.map((item) => {
const newDataKey = item.dataKey.split('.').pop();
return {
...item,
dataKey: newDataKey,
payload: {
...item.payload,
name: newDataKey,
dataKey: newDataKey,
},
};
});
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Dependencies check up
What version of @mantine/* packages do you have in package.json?
7.6.1
What package has an issue?
@mantine/charts
What framework do you use?
Vite
In which browsers you can reproduce the issue?
All
Describe the bug
For the LineChart sample, if I nested data values one level deeper (see code below), the chart legend would not display value, while the chart lines would still be corrent.
Since the chart lines could work fine with nested values, the legend should work fine too?
If possible, include a link to a codesandbox with a minimal reproduction
No response
Possible fix
No response
Self-service
The text was updated successfully, but these errors were encountered: