Skip to content
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

Displaying Multiple Y-Values for a Single X-Value in a Scatter Chart #324

Open
valli029 opened this issue Aug 2, 2024 · 2 comments
Open

Comments

@valli029
Copy link

valli029 commented Aug 2, 2024

Question

Is it possible to display multiple y-values for the same x-value in a scatter chart?

@zibs
Copy link
Contributor

zibs commented Aug 14, 2024

I'm not totally sure off the top of my head, but have you tried using two scatter charts as siblings, something like:

....
<CartesianChart
          yKeys={["y", "y2"]} ... >
....
 <Scatter
                radius={scatterRadius}
                points={points.y}
                animate={{ type: "spring" }}
                color={colors.blue}
              />
 <Scatter
                radius={scatterRadius}
                points={points.y2}
                animate={{ type: "spring" }}
                color={colors.red}
              />
....

@MrShakes
Copy link

Hi @zibs, I'm trying to do something similar to what's displayed in the image, using your suggestion I'd have to use a for loop to add <Scatter for possibly hundreds of points, is this a good way to go, is there a better way?

Image

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

3 participants