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

[Bar] Option to decide label position #2579

Closed
evasseure opened this issue May 2, 2024 · 2 comments · Fixed by #2585
Closed

[Bar] Option to decide label position #2579

evasseure opened this issue May 2, 2024 · 2 comments · Fixed by #2585

Comments

@evasseure
Copy link
Contributor

Hello 👋

We currently need to have the option to place the bar labels either on top (or end when horizontal) of the bars.
It seems to be something that has been asked for a few time #923 #146, and a PR has also been opened for it #1112.

So I was wondering if this is a feature you be open to receive a new PR for, or would you rather not have it implemented into Nivo, and leave it to the devs to implement their own?

It could come in the form of two new params:

  • labelPosition: "center" | "top" (end maybe?)
  • topLabelOffset: number (could also be merged with the recently added totalsOffset)

The top position would not be compatible with the stacked mode.

Cheers

@plouc
Copy link
Owner

plouc commented May 2, 2024

Hello @evasseure,

I'm fine with adding this feature, but I'm working on other things atm.

I think it should be something like 'start' | 'center' | 'end', in order to avoid any confusion when changing the layout.
We could also leave complete freedom and support top-left, top, top-right, ... but then we would probably need 2 props to support x and y offsets, might become a bit too complex though.

On the other hand, that it's something which can be relatively easily implemented via a custom layer.

@evasseure
Copy link
Contributor Author

Thanks for the quick feedback!
Closing now that I have opened a PR.

@plouc plouc linked a pull request Jul 2, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

2 participants