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

Starting position of labels #41

Open
stephansann opened this issue Nov 2, 2024 · 11 comments
Open

Starting position of labels #41

stephansann opened this issue Nov 2, 2024 · 11 comments
Labels
bug Something isn't working feature

Comments

@stephansann
Copy link

In my chart I would like to only have every second bar-pair to have a label and I do not want a rotation on size conflicts.
I managed to achieve this with this code:

                ColumnChart(
                    modifier = Modifier.fillMaxWidth().height(200.dp).padding(horizontal = 22.dp),
                    data = assembleStatisticBars(tmpStatisticsState.value.dayStatistics.sortedBy { it.date }),
                    labelProperties = LabelProperties(
                        textStyle = TextStyle.Default,
                        enabled = true,
                        rotationDegreeOnSizeConflict = 0F
                    ),
                    animationSpec = spring(
                        dampingRatio = Spring.DampingRatioMediumBouncy,
                        stiffness = Spring.StiffnessLow
                    )
                )

Anyhow it looks a bit off that the labels are starting in front of the y-axis:

SCR-20241102-sfho

Wouldn't it make more sense to always start the first label on x-position 0!?

Thanks 🙏🏻

@ehsannarmani
Copy link
Owner

Hi @stephansann .
The bad position of labels is chart problem.
Today i will release a new version with some changes, i think in the new version the positions will better.

@stephansann
Copy link
Author

Great.
And there is another thing that is a bit visual odd, which I noticed today.

The bars which belong together should IMHO not be further apart than the distance to the next bar-pair.

Here it looks like a "wrong pairing":

SCR-20241103-ldoc

@stephansann
Copy link
Author

Was able to better the situation with "BarProperties(spacing = 1.dp)".
Anyhow IMHO the default should be that the spacing between the bars is not greater than the spacing to the next bar-pair.

@ehsannarmani
Copy link
Owner

0.0.15 version is released, please check that and let me notified if there is any improvement of positioning labels

@stephansann
Copy link
Author

Bravo! 👏🏻

Now it looks amazing:

SCR-20241103-mrza

Thanks so much for the great work!

@stephansann
Copy link
Author

Additional nerd idea:
To make it 110% perfect, the first bar-pair should not start on the very left, but in the middle of the proportional portion of the chart.
Same for the last bar-pair.

Like so:

SCR-20241103-mwqm

@ehsannarmani
Copy link
Owner

Ok, in the next version ill try to add start padding option for bars to be able to specify that.

@stephansann
Copy link
Author

On a second thought, not only the first and last bar-pair should be in the middle of their proportional portion. Every bar-pair should be in the middle of their proportional portion 🤓

@the-blue-app
Copy link

Hi. I am on 0.0.16. Labels are still miss aligned

SCR-20241114-oyrv

@ehsannarmani ehsannarmani added the bug Something isn't working label Nov 14, 2024
@nqmgaming
Copy link

I have the same problem like @the-blue-app

@nqmgaming
Copy link

ah I just updated the version to 0.0.19 and it's ok now, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working feature
Projects
None yet
Development

No branches or pull requests

4 participants