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

VictoryStack Custom Baseline Support #1832

Merged
merged 4 commits into from
May 5, 2021
Merged

VictoryStack Custom Baseline Support #1832

merged 4 commits into from
May 5, 2021

Conversation

jhumbug
Copy link
Contributor

@jhumbug jhumbug commented May 5, 2021

Adds support for supplying custom baselines (y0) to the first child in a set of VictoryStack wrapped components, so that they stack correctly based on that first dataset.

Example:

<VictoryChart>
  <VictoryStack>
    <VictoryArea
      style={{ data: { fill: "red" } }}
      data={[
        { x: 1, y: 2, y0: 1 },
        { x: 2, y: 1, y0: -2 },
        { x: 3, y: 4, y0: 1 },
        { x: 4, y: 2, y0: -3 }
      ]}
    />
    <VictoryArea
      data={[
        { x: 1, y: 2 },
        { x: 2, y: 1 },
        { x: 3, y: 4 },
        { x: 4, y: 2 }
      ]}
    />
    <VictoryArea
      data={[
        { x: 1, y: 2 },
        { x: 2, y: 1 },
        { x: 3, y: 4 },
        { x: 4, y: 2 }
      ]}
    />
    <VictoryArea
      data={[
        { x: 1, y: 1 },
        { x: 2, y: 4 },
        { x: 3, y: 3 },
        { x: 4, y: 8 }
      ]}
    />
  </VictoryStack>
</VictoryChart>

Previous:
Screen Shot 2021-05-05 at 10 38 01 AM
After:
Screen Shot 2021-05-04 at 4 50 00 PM

@boygirl
Copy link
Contributor

boygirl commented May 5, 2021

@jhumbug perfect! I love a straightforward change. Can you also add your example as a story?

@jhumbug jhumbug marked this pull request as ready for review May 5, 2021 18:13
@jhumbug jhumbug requested a review from boygirl May 5, 2021 18:22
Copy link
Contributor

@boygirl boygirl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work!

@jhumbug jhumbug merged commit d845424 into main May 5, 2021
@boygirl boygirl deleted the stack-custom-baselines branch May 28, 2021 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants