We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Xamarin Chart Size

Hello Syncfusion,

We are evaluating your Chart for Xamarin.Forms, we are using version 12.4451.0.34 where from Xamarin Components page you reported a fix about the Chart not rendering inside a StackLayout : 

Fix

  • #132462 - Chart now renders with the available parent size when hosted inside a StackLayout or a ScrollViewer.
Now, it seems we are encoutering the same problem or a similar one : If we try to put the chart into a StackLayout as a child nothing it's rendered, we tried to set the size of the Chart but didn't work (the space is taken but nothing is shown), only If we set it as Content of the page then it will be rendered, but at full page size. Can we set the size of the chart in someway?

Thanks,
Daniele.

3 Replies

MK Magesh Kumar Krishnan Syncfusion Team April 1, 2015 12:34 PM UTC

Hi Daniele,

Thanks for using Syncfusion products.

We would like to let you know that we have to set VerticalOptions or HorizontalOptions for Chart when you add into Vertical or Horizontal StackLayout respectively. So chart will plot in remaining space inside StackLayout.

Please refer the below code snippet.

Code snippet [C#]:

Chart.HorizontalOptions = LayoutOptions.FillAndExpand;

Chart.VerticalOptions = LayoutOptions.FillAndExpand;


We have also prepared a sample and it can downloaded from following link.

http://www.syncfusion.com/downloads/support/directtrac/137347/ChartSample_Width_Height1315186565.zip 

You can also specify the exact Width and Height for the Chart as shown in the below code snippet.

Code snippet [C#]:

Chart.HeightRequest = 300;

Chart.WidthRequest = 300;


Please let us know if you require further assistance on this.

Thanks,
Magesh Kumar K


DA daniele April 7, 2015 12:28 PM UTC

Thanks, this helped us to figure it out... just to let you know... in our case if we set VerticalOptions, HeightRequest is ignored, also if we use Center or any other enum value. 

Thanks for the fast and great support! 

Daniele.


MK Magesh Kumar Krishnan Syncfusion Team April 8, 2015 04:46 AM UTC

Hi Daniele,

Thanks for the update.
Please let us know if you require further assistance on this

Thanks,
Magesh Kumar K

Loader.
Live Chat Icon For mobile
Up arrow icon