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

Is it possible to create an area with multiple y0? #284

Open
andreyukD opened this issue May 29, 2024 · 3 comments
Open

Is it possible to create an area with multiple y0? #284

andreyukD opened this issue May 29, 2024 · 3 comments
Labels
enhancement New feature or request issue-accepted The issue is confirmed and accepted by the maintainers

Comments

@andreyukD
Copy link

andreyukD commented May 29, 2024

Question

1

As in the picture, I have two areas. The question is about an area where the bottom is not a number, but an array of numbers. Is it possible to implement this now in a new version?

I'm using useAreaPath which accepts y0 as a number

@zibs
Copy link
Contributor

zibs commented May 30, 2024

I don't think you can set the y0 to an array of numbers.

But you could use multiple Area charts in a single chart if you have another yKey to use, like z in this example:

   <CartesianChart data={DATA} xKey="x" yKeys={["y", "z"]}>
      {({ points, chartBounds }) => (
        //👇 pass a PointsArray to the Line component, y0, as well as options.
        <Area
          points={points.y}
          y0={chartBounds.bottom}
          color="red"
          animate={{ type: "timing", duration: 300 }}
        />
     <Area
          points={points.z}
          y0={chartBounds.bottom}
          color="blue"
          animate={{ type: "timing", duration: 300 }}
        />
      )}
    </CartesianChart>

@andreyukD
Copy link
Author

Thanks, I know that a new version allows for creating multiple areas, but I still can't make an area of "difference" (dark red area on the left image). It was achievable in an older version though. Do you have any plans to add this functionality?

@weuniok
Copy link

weuniok commented Jun 8, 2024

So, is there currently no way to make an area between 2 data sets like in the non-native victory unless one of them has constant y?

https://commerce.nearform.com/open-source/victory/docs/victory-area#data
image

@carbonrobot carbonrobot added enhancement New feature or request issue-accepted The issue is confirmed and accepted by the maintainers labels Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request issue-accepted The issue is confirmed and accepted by the maintainers
Projects
None yet
Development

No branches or pull requests

4 participants