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

Bottom label truncated sometimes #776

Open
neobie opened this issue Jun 28, 2024 · 10 comments
Open

Bottom label truncated sometimes #776

neobie opened this issue Jun 28, 2024 · 10 comments

Comments

@neobie
Copy link

neobie commented Jun 28, 2024

How to reproduce

There are around 20 points
var spacing = 20/3
itemPlacer = AxisItemPlacer.Horizontal.default(spacing = spacing, offset = spacing / 3, addExtremeLabelPadding = true),

Observed behavior

image

Expected behavior

The label should not truncated providing there are plenty of spaces.

Vico version(s)

1.15.0-alpha.1

Android version(s)

wearos 30

Additional information

Sometimes it happen, but sometimes it don't (provided with dynamic data)
Version 1.15

@neobie neobie added the bug label Jun 28, 2024
@patrickmichalik
Copy link
Member

patrickmichalik commented Jun 30, 2024

Hello! Thanks for the report. HorizontalAxis labels are centered relative to their x coordinates. A label’s maximum width is determined by the amount of room on the side with less free space. Here, there’s insufficient space to the left of the first label—some padding would be required for the label not to be truncated.

In Vico 1, addExtremeLabelPadding works only for labels whose x values are ChartValues.minX or ChartValues.maxX. The leftmost and rightmost labels in your chart don’t meet this requirement, hence the truncation issue. This has been addressed in Vico 2—now, addExtremeLabelPadding works for the first and last labels regardless of their x values. There’s currently a bug that can cause an excessive amount of padding to be added in charts with zoom disabled, but this will be resolved in Vico 2.0.0 Alpha 22, which we plan on releasing shortly.

Please consider updating to Vico 2.0.0 Alpha 22 once it’s available. The behavior observed in Vico 1, while suboptimal, isn’t a bug, and Vico 1 receives only bug fixes. A possible workaround for Vico 1 is to manually add some padding, which you can do via HorizontalLayout.FullWidth, but this won’t be as reliable as Vico 2.0.0 Alpha 22’s addExtremeLabelPadding.

Please also note that, by default, some padding is added to axis labels, making them wider than their text. You may want to remove this padding. Let me know if you need any help doing so. Finally, I wanted to mention that the Vico 1 documentation appears to wrongly suggest that addExtremeLabelPadding behaves as it does in Vico 2, and this inaccuracy will be corrected.

@patrickmichalik
Copy link
Member

Vico 2.0.0 Alpha 22 is now available.

@hadys7s
Copy link

hadys7s commented Aug 9, 2024

63915c39-b3f1-41e4-a8e8-d45d2767b602
still happening with me please i need help asap

@Gowsky
Copy link
Member

Gowsky commented Aug 10, 2024

@hadys7s this issue concerns the first and last labels being truncated. Can you please explain which labels in your image are truncated? Also, you’ve already asked this question in #838. What is the purpose of duplicating it?

@hadys7s
Copy link

hadys7s commented Aug 10, 2024

sorry i don't know if it's an issue or still not supported
b8925823-e01d-42ac-8ee2-db95a277a5a4

this is happening to me there are alot of empty x axis i dont want to show them but still it's taking space from the x axis here i used horizontalLayout = HorizontalLayout.segmented(),
and when i use horizontalLayout = HorizontalLayout.fullWidth(),
it shows the first label only

1c7402bf-e1c5-4e0d-8e79-c8869f9cdd88

@Gowsky
Copy link
Member

Gowsky commented Aug 10, 2024

@hadys7s, it is supported, but we need to see your code to help you achieve the desired result. Please share a runnable snippet, but under your discussion, not under this unrelated issue.

@hadys7s
Copy link

hadys7s commented Aug 10, 2024

okay thank u

@hadys7s
Copy link

hadys7s commented Aug 10, 2024

done please check and thanks for the quick reply and for ur help really appreciate it @Gowsky

@patrickmichalik
Copy link
Member

I’m adding the “done in beta” label because, as per my previous comment, the documentation error doesn’t affect Vico 2, which is currently in beta. It looks like I forgot to add the appropriate label previously.

@patrickmichalik
Copy link
Member

Vico 1.16.0 Alpha 1 addresses the documentation inaccuracy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants