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

Always show first and last ticks? #30

Open
frnsys opened this issue Aug 29, 2024 · 5 comments
Open

Always show first and last ticks? #30

frnsys opened this issue Aug 29, 2024 · 5 comments

Comments

@frnsys
Copy link
Contributor

frnsys commented Aug 29, 2024

Hey, thanks for this library. Is there an option to always show the first and last ticks?

@feral-dot-io
Copy link
Owner

Does Series with_min_x and with_max_x (and also for _y) work for you?

@frnsys
Copy link
Contributor Author

frnsys commented Aug 30, 2024

Unfortunately no, manually setting hasn't changed it:

image

@feral-dot-io
Copy link
Owner

Thanks for the image. To be clear, is it the date ticks that you want shown first and last? What values do you want to them to show?

If it's 2010 and 2023 then they will spill over the edges and could overlap labels on the side.

If it's 2011 and 2022 then there might not be enough space for the text plus padding. Can you share an image with <Chart debug=true ... /> set? It will give an idea of the spacing involved.

@frnsys
Copy link
Contributor Author

frnsys commented Aug 30, 2024

Yes, sorry for not clarifying, it's the X-axis/date ticks. The actual min and maxes are 2010 and 2023. Is there some way to set it so that the first and last ticks are left and right anchored, respectively?

Here it is with debug enabled:

image

and if it's useful, my padding is set to:

                padding=Padding::sides(2., 3., 1., 3.)

@feral-dot-io
Copy link
Owner

Can you share the full call? There's some extra spacing inside the tick labels that probably shouldn't be there.

The other thing is that the date picking algorithm is trying to pick the most relevant periods (in this case years) and then it's trying to fit as many as possible. I think this is done by having a preference for the end ranges of the data although my memory is a little fuzzy on this.

The issue with what you're asking for is that the second half of the "2023" label would leak out into right edge and then overlap the kWh label. The right tick labels are kind of doing it already so I'm thinking it might be worthwhile making this choice configurable (extend labels into the corner space) and making it the default for x ticks which are most likely to be dates.

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

No branches or pull requests

2 participants