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

Multiline data name in VictoryLegend causes incorrect spacing between label elements #2803

Open
2 tasks done
ryanseipp opened this issue Feb 12, 2024 · 0 comments
Open
2 tasks done
Labels
Issue: Accepted The submitted issue has been confirmed by the Victory core team Type: Bug 🐛 Oh no! A bug or unintentional behavior

Comments

@ryanseipp
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Code of Conduct

  • I agree to follow this project's Code of Conduct

Victory version

36.6.8

Code Sandbox link

No response

Bug report

I have one or more legend labels that need to span multiple lines, which I achieve by placing a newline character into the label string (`\n`). In either vertical or horizontal orientation of the labels, this causes excess space to be added to label elements that occur below the multiline label.

Steps to reproduce

Go to https://commerce.nearform.com/open-source/victory/docs/victory-legend#data
Paste the following into the text box:

<VictoryLegend x={125} y={50}
  orientation="vertical"
  data={[
    { name: "One\nNext" },
    { name: "Two" },
    { name: "Three" }
  ]}
/>

The following is an example for horizontal orientation:

<VictoryLegend x={125} y={50}
  orientation="horizontal"
  itemsPerRow={2}
  data={[
    { name: "One\nNext" },
    { name: "Two" },
    { name: "Three" },
    { name: "Four" },
    { name: "Five" },
    { name: "Six" }
  ]}
/>

Expected behavior

Space between legend elements would remain consistent, either respecting `rowGutter` so the user of Victory can account for this, or automatically for every row.

Actual behavior

Excess space is added to only the next row of legend items.

Environment

- Device: Desktop
- OS: macOS Sonoma 14.2.1
- Node: 20.11.0
- npm: 10.2.4
@ryanseipp ryanseipp added the Type: Bug 🐛 Oh no! A bug or unintentional behavior label Feb 12, 2024
@carbonrobot carbonrobot added the Issue: Accepted The submitted issue has been confirmed by the Victory core team label Feb 15, 2024
@acharyakavita acharyakavita self-assigned this Feb 20, 2024
@acharyakavita acharyakavita removed their assignment Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue: Accepted The submitted issue has been confirmed by the Victory core team Type: Bug 🐛 Oh no! A bug or unintentional behavior
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

3 participants