Open neobie opened 2 months ago
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.
Vico 2.0.0 Alpha 22 is now available.
still happening with me please i need help asap
@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?
sorry i don't know if it's an issue or still not supported
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
@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.
okay thank u
done please check and thanks for the quick reply and for ur help really appreciate it @Gowsky
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
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