microcharts-dotnet / Microcharts

Create cross-platform (Xamarin, Windows, ...) simple charts.
MIT License
2.01k stars 360 forks source link

[Question] How to make chart's size relative in Xamarin.Android? #254

Open jevgenijusmarinuskinas opened 3 years ago

jevgenijusmarinuskinas commented 3 years ago

Hello,

I've encountered an issue with setting the relative height of Microcharts in Xamarin.Android. If I set it to wrap_content, it would take all the screen, seems like it would ignore this parameter... The only workaround I've got so far is specifying it explicitly, like 250dp..

android:layout_height="250dp"

Is there any chance to make it relative to the size of the viewport?

<LinearLayout android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center_horizontal|center_vertical"> <Microcharts.Droid.ChartView android:layout_width="match_parent" android:layout_height="250dp" android:minWidth="25px" android:minHeight="25px" android:id="@+id/chartView1" /> </LinearLayout>

eman1986 commented 3 years ago

I always set a certain height so I've never tried setting it to take the whole screen, but if it doesn't take the whole screen when asked, it might be a bug somewhere.