<chart:SfChart.Series>
<chart:FastLineSeries IsTransposed="True" ItemsSource="{Binding Data}" XBindingPath="XValue" YBindingPath="YValue" />
</chart:SfChart.Series>
|
<StackLayout >
……
<chart:SfChart x:Name="chart" AreaBorderColor="Teal" HeightRequest="350" WidthRequest="350" VerticalOptions="Start" >
……..
</chart:SfChart>
</StackLayout>
|
protected override void OnSizeAllocated(double width, double height)
{
base.OnSizeAllocated(width, height);
if (height > 0 && width > 0)
{
if (height > width)
{
chart.HorizontalOptions = LayoutOptions.FillAndExpand;
}
else
{
chart.HorizontalOptions = LayoutOptions.End;
}
}
}
|
Portrait |
|
Landscape |
|