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

Fixed the error related to placement of x-axis tick labels consistently #2843

Closed
wants to merge 3 commits into from

Conversation

Anubhav-2003
Copy link
Contributor

Fixes: #2690

The following PR fixes the placement of x-axis tick labels for the extreme positions to center.

@Anubhav-2003
Copy link
Contributor Author

@sophiamersmann Kindly review my PR. Thank You.

@marcelgerber marcelgerber self-requested a review October 25, 2023 11:46
@marcelgerber
Copy link
Member

Hi @Anubhav-2003, very nice work!

When looking at this I also looked back at #975, which is the PR that introduced this code back in 2021. Back then, the main problem was that in some cases when faceting, axis labels would overlap.

And while this PR works great in most cases, and the result indeed looks much better, there are also a few cases where it causes overlapping or cut-off text:

A bunch of screenshots

CleanShot 2023-10-25 at 14 22 35
CleanShot 2023-10-25 at 14 22 57
CleanShot 2023-10-25 at 14 23 05
CleanShot 2023-10-25 at 14 23 12
CleanShot 2023-10-25 at 14 23 19

However, I agree that we can do better in most cases, and in my head I'm currently thinking that the following would be a good solution:

  • Place the x axis tick labels centered below the ticks, except if
    1. the chart is in faceting mode, or
    2. the axis labels are "particularly long" (some heuristic, but maybe more than 6 or 7 characters?)

Another (potentially more scalable) alternative would also be to pass to an axis a "safe zone" where it can render text without causing overlap - and where it would instead default to the right/left-aligning if the space is not enough.

I checked the AxisConfig interface, and sadly there's currently not a good way to determine (1).


So, overall, this requires some more work.
Feel free to continue working on this, Anubhav, but also don't feel obliged to do so. This is not quite that easy to solve any more and will require some hours.
Also, do feel free to reach out to me or Sophia whenever you need our input. Thank you!

Copy link
Member

@marcelgerber marcelgerber left a comment

Choose a reason for hiding this comment

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

See the comment above ⬆️

@Anubhav-2003
Copy link
Contributor Author

@marcelgerber Thank you a lot for your such a comprehensive input. I will try my best to implement the changes you pointed out, and will keep working on the issue. But as I am new to the world of open source, I may feel a bit overwhelemd and make a few mistakes.

Also, I may solve a few other issue in the organization to get a better understanding about the flow of logic in the code, and gain a bit more confidence, along with your guidance :)

@marcelgerber
Copy link
Member

Yes that sounds great!
Again, this issue actually turns out to be not super easy to solve in a good way. So, don't get too hung up on this one and feel free to pick out another issue - or reach out to us.

Copy link

github-actions bot commented Nov 9, 2023

This PR has had no activity within the last two weeks. It is considered stale and will be closed in 3 days if no further activity is detected.

@github-actions github-actions bot added the stale label Nov 9, 2023
@github-actions github-actions bot closed this Nov 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Place x-axis tick labels consistently
2 participants