bmarrdev / android-DecoView-charting

DecoView: Android arc based animated charting library
Apache License 2.0
991 stars 194 forks source link

Line width completely different for different screen sizes #28

Open MarkOSullivan94 opened 7 years ago

MarkOSullivan94 commented 7 years ago

I've noticed a problem when comparing the charts on different screen sizes. While the line width might look perfect on one phone, if you use a phone with a smaller screen size the line width looks too thick.

ghost commented 7 years ago

You have to do something like float decoViewLineWidth = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 15, Resources.getSystem().getDisplayMetrics()); so that you're working with dp not pixels - in this example 15dp is the line width

MarkOSullivan94 commented 7 years ago

@nocturne9op2 tried out your suggestion but this still doesn't look great when scaling. I've taken screenshots when using an emulated Nexus 10 and an emulated Pixel.

I think there'll be complications whenever doing a layout for tablets as you can only specify the line width programmatically

screenshot_1490805111 screenshot_1490805185

ghost commented 7 years ago

I see, I ran into some DecoView proportion issues as well while I was finishing my app. A way around this is to set a different line width for tablets. Android recommends using different xml layouts to suit different screen sizes anyway.

MarkOSullivan94 commented 7 years ago

Android recommends using different xml layouts to suit different screen sizes anyway.

@nocturne9op2 unfortunately the line width cannot be specified within the XML layouts. If that was the case, it would have made it a lot easier using this library for all different screen sizes.

ghost commented 7 years ago

You should be able to programmatically check whether the device is a phone or tablet, then set the line width accordingly.