-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Bars Overlap axis When minValue is greater than 0. #1188
Comments
@plouc mentioned on discord we could clamp this except it's very complex given how flexible the bar behavior is (grouped vs stacked), (bars vs columns,) etc. It seems like it would be straightforward for grouped bars based on orientation. I can see how stacked values would make this more complex, though. |
Adding logic in the scales package for |
@wyze super cool. The specified tickValues were just something from the example I grabbed; nothing important. Is that something you did just there in codesandbox, or were there additional changes to the way Bar exposes its scales to do it? |
Just a couple changes to scales package. Here nivo/packages/scales/src/linearScale.js Line 13 in 8451c27
, clamp = false to the first parameter.
Then somewhere down here nivo/packages/scales/src/linearScale.js Line 34 in 8451c27 if (clamp) { scale.clamp(true) } .
Update PropTypes in that Update typings for scales package here nivo/packages/scales/index.d.ts Line 16 in 8451c27
clamp?: boolean .
That should do it. |
That is about the friendliest indirect invitation to PR that I have ever received 😄 |
I wasn't sure if you wanted to contribute or not, don't feel pressured to do so. :) |
would love to. just racing towards a deadline at present. This is linked in our backlog, so it's not unlikely someone will circle back and contribute :D |
Hoping to have some time to contribute here, soon. |
Optional ability to tell a scale to clamp. use case e.g. setting bar value below zero fixes plouc#1188
Optional ability to tell a scale to clamp. use case e.g. setting bar value below zero fixes plouc#1188
Optional ability to tell a scale to clamp. use case e.g. setting bar value below zero fixes #1188 Co-authored-by: Sam Jones <[email protected]>
Optional ability to tell a scale to clamp. use case e.g. setting bar value below zero fixes plouc#1188 Co-authored-by: Sam Jones <[email protected]>
Describe/explain the bug
If bar axis minimum is set much above 0, the bars extend off the edge of the chart and obscure the axis & its labels
To Reproduce
https://codesandbox.io/s/nivobar-chart-overlapping-axis-mod21?file=/src/index.js
Steps to reproduce the behavior:
minValue
to be > 0. 20% or so of smallest entry works best to reproduce.Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
Desktop (please complete the following information):
Additional context
I might be able to work around this in my app by adjusting the stack order...
The text was updated successfully, but these errors were encountered: