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

PointerSpeedometer tick labels overlap the speedometer bar and its default tickPadding isn't correct #214

Closed
gxcare opened this issue Jul 26, 2021 · 3 comments
Labels
Bug bug!!

Comments

@gxcare
Copy link

gxcare commented Jul 26, 2021

Describe the bug
Labels of ticks with PointerSpeedometer are drawn below the speed indication. They should be put by default more on the inside to not overlap with the speed indication. It seems also that labels are not set corresponding to tick positions.
It would be nice to have the option to let them be drawn on top of the speed indication as well and have the possibility to choose where to put the text.

XML & code
<com.github.anastr.speedviewlib.PointerSpeedometer
android:id="@+id/speedView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:sv_unit = " Mbps"
app:sv_withTremble="false"
app:sv_tickNumber="9"
app:sv_speedometerColor="#80ff0000"/>

Screenshots
immagine

@gxcare gxcare added the Bug report Participants report a bug label Jul 26, 2021
@anastr anastr added Bug bug!! and removed Bug report Participants report a bug labels Jul 26, 2021
@anastr
Copy link
Owner

anastr commented Jul 26, 2021

You can play with ticks' position with app:sv_tickPadding="32dp", by default it shouldn't be close to the speedometer's bar. This will be fixed by the next version, you can change sv_tickPadding for now by yourself.

The overlap issue appear only on this type of speedometers. Because it has a responsive speedometer bar that change its color depending on current speed, unlike other speedometers which have a static bar drown only once. So, in this speedometer I think I will have to redraw the ticks over the speedometer bar on each frame. Hope it will not affect the performance though.

Your ticks and marks aren't matching because you have not matching number of ticks and marks. To make them so, you need to set mark number lower than tick number by 2 (Because ticks have min & max positions over marks). In your case you have 8 marks and 10 ticks, so you need either to increase ticks app:sv_tickNumber="10" or decrease marks app:sv_marksNumber="7".

@anastr anastr changed the title PointerSpeedometer tick labels PointerSpeedometer tick labels overlap the speedometer bar and its default tickPadding isn't correct Jul 26, 2021
@gxcare
Copy link
Author

gxcare commented Jul 31, 2021

I was able to fix the position and the ticks following your suggestions.
The only problem that remains is then the default settings that should avoid the overlap.
It would be nice then to have the possibility to have the marks also at 0% and 100%. To ease initialization in Java setTicks() should take a List as argument, not ArrayList.
Thanks.

@anastr
Copy link
Owner

anastr commented Nov 11, 2021

Fixed in version 1.5.53.

@anastr anastr closed this as completed Nov 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug bug!!
Projects
None yet
Development

No branches or pull requests

2 participants