Skip to content

Multiple charts using ContinuousColorsLegendSvg share the same legend color scale #2686

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

Open
palatinus-sb opened this issue Feb 10, 2025 · 0 comments

Comments

@palatinus-sb
Copy link

palatinus-sb commented Feb 10, 2025

Description

"@nivo/core": "0.88.0",
"@nivo/heatmap": "0.88.0",

Multiple charts using ContinuousColorsLegendSvg (like Heatmap) share the same legend color scale even if differing colors were passed to them as props.

To Reproduce
CodeSandbox showcasing the bug: https://codesandbox.io/p/sandbox/nivo-legends-bug-y6l5kd

Steps to reproduce the behavior:

  1. Create a project with 2 or more Heatmap charts
  2. Pass them the required props along with 1 legend for each chart
  3. Define differing colors for each chart
  4. Notice that all charts share the same color scale for their legends

Expected behavior
Each chart's legend to inherit the chart's coloring and not share the same color scale.

Screenshots
Image

Additional context
The bug appears to come from the non-unique id generation inside ContinuousColorsLegendSvg resulting in an id conflict inside the DOM.

const id = `ContinuousColorsLegendSvgGradient.${direction}.${colorStops

@palatinus-sb palatinus-sb changed the title Multiple charts using ContinuousColorsLegendSvg share the same legend color scale Multiple charts using ContinuousColorsLegendSvg share the same legend color scale Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant