- Home
- Forum
- Xamarin.Forms
- SfChart Data not showing when inside SfRotator
SfChart Data not showing when inside SfRotator
Dear Syncfusion Support,
I have a SfRotator Control where I want to display various different charts. Adding the Charts as Items (without templates) works as intended. However, the Charts do not display any data. If I move the Chart control out of the rotator ItemContent, the data is perfectly displayed. (Without changing anything in the code).
My Xaml looks like this (I'm using ChartDataPoint):
<sfrotator:SfRotator Grid.Row="0" x:Name="rotator" Margin="0" SelectedDotColor="{StaticResource Primary}">
<sfrotator:SfRotator.DataSource>
<sfrotator:SfRotatorItem>
<sfrotator:SfRotatorItem.ItemContent>
<Grid HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
<chart:SfChart x:Name="ChartTrend">
<chart:CandleSeries ItemsSource ="{Binding Data}"
XBindingPath="XValue"
High="High"
Low="Low"
Open="Open"
Close="Close"
EnableAnimation = "true"
AnimationDuration="0.8" />
<chart:SfChart.PrimaryAxis>
<chart:DateTimeAxis >
</chart:DateTimeAxis>
</chart:SfChart.PrimaryAxis>
<chart:SfChart.SecondaryAxis>
<chart:NumericalAxis />
</chart:SfChart.SecondaryAxis>
<chart:SfChart.ChartBehaviors>
<chart:ChartZoomPanBehavior/>
</chart:SfChart.ChartBehaviors>
</chart:SfChart>
<ActivityIndicator VerticalOptions="Center" HorizontalOptions="Center"
Color="{StaticResource Primary}" IsVisible="{Binding IsChartTrendLoading}"
IsRunning="{Binding IsChartTrendLoading}" />
</Grid>
</sfrotator:SfRotatorItem.ItemContent>
</sfrotator:SfRotatorItem>
</sfrotator:SfRotator.DataSource>
</sfrotator:SfRotator>
Attached you find an image showing the issue.
Looking forward to hearing from you.
Thanks in advance and ,
Chris
SIGN IN To post a reply.
3 Replies
CS
Christof Steps
October 31, 2017 09:31 AM UTC
CS
Christof Steps
October 31, 2017 10:29 AM UTC
I was able to find the cause of the issue: The Binding does not work inside the SfRotator.
To fix that, I need to manually set the ItemsSource of the Series everytime I change the data behind it in code behind:
TrendSeries.ItemsSource = viewModel.Data;
Not the cleanest solution, but it works.
MS
Mariappan S
Syncfusion Team
November 2, 2017 02:11 PM UTC
Hi Christof Steps
Thank you for contacting Syncfusion support.
We have checked the reported issue. ContentPage BindingContext doesn’t transferred inside the SfRotator.DataSource property collection of objects. We suggest you to bind the ContentPage BindingContext inside the SfRotatorItem content of SfChart control. We have prepared sample for the same. Please download the sample from the following link.
Sample link: SfRotatorSample
Regards,
Mariappan S.
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
CS Christof Steps
- Oct 31, 2017 09:30 AM UTC
- Nov 2, 2017 02:11 PM UTC