Hello,
I have a Xam Doughnut Chart that after reloading data after a few times, causes the application to crash. I've been trying to debug for quite some time but i haven't found the issue until i looked into the call stack that showed where it might be blowing up, but I dont know whats causing it.
Code
<ig:XamDoughnutChart x:Name="CurrentAccountChart" Grid.Column="0" InnerExtent="70"> <ig:XamDoughnutChart.Series> <ig:RingSeries x:Name="CurrentAccountRingSeries" FormatLabel="CurrentAccountRingSeries_FormatLabel" ItemsSource="{Binding CurrentAccountBySeniority}" LabelExtent="15" LabelMemberPath="ValueLabel" LabelInnerColor="#51667a" LabelOuterColor="#51667a" LabelsPosition="OutsideEnd" LeaderLineType="Straight" LeaderLineVisibility="Visible" Legend="{x:Reference CurrentAccountLegend}" LegendLabelMemberPath="Label" RadiusFactor="0.6" StartAngle="150" ValueMemberPath="ValueLabel" /> </ig:XamDoughnutChart.Series> </ig:XamDoughnutChart> <ig:ItemLegend x:Name="CurrentAccountLegend" Grid.Column="1" HorizontalOptions="EndAndExpand" VerticalOptions="EndAndExpand" />
Call Stack with Exception
Hello and thank you for contacting Infragistics. First try unhooking FormatLabel and see if that is causing it. It's possible it's trying to format something that isn't available anymore (perhaps a timing issue). Please provide the code used to reload the data. Are you refreshing CurrencyAccountBySeniority? A sample isolating the behavior would very much help seeing how this is the first we're hearing about this issue.
Hello and thank you for your reply. After further investigation, it may not be related to reloading data because no exception was thrown during that process and the data was being loaded with no issues. The Format Label was removed to see if it was causing the issue but it didnt change nothing. However we forgot to write an important detail that might shed more light on whats going causing the issue.
View
The Doughnutchart is inside a content view, which is part of a carousel view that works similar to a tabbed page. The error occurs when we try to switch from tab to tab, from start to finish and the going back the first (Dashboard), where crash occurs after a few of these cycles.
Home Page View
<ContentPage x:Class="WaveTradeX.Views.HomePage" xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:cards="clr-namespace:PanCardView;assembly=PanCardView" ... > <ContentPage.Content> <Grid Margin="0" Padding="0" BackgroundColor="{StaticResource athensGrayColor}" ColumnSpacing="0" RowSpacing="0"> <Grid.RowDefinitions> <RowDefinition Height="15" /> <RowDefinition Height="55" /> </Grid.RowDefinitions> <!--#region Carousel --> <cards:CarouselView Grid.Row="0" HorizontalOptions="FillAndExpand" IsUserInteractionEnabled="False" SelectedIndex="{Binding Position}" ShouldThrottlePanInteraction="True" VerticalOptions="FillAndExpand"> <cards:CarouselView.ItemsSource> <x:Array Type="{x:Type View}"> <ContentView> <local:DashboardPage /> </ContentView> <ContentView> <local:LeadsPage /> </ContentView> <ContentView> <local:ClientsPage /> </ContentView> <ContentView> <local:PlanningPage /> </ContentView> <ContentView> <shared:TasksPage/> </ContentView> <ContentView> <shared:OpportunitiesPage/> </ContentView> <ContentView> <shared:SchedulesPage /> </ContentView> <ContentView> <local:SyncPage/> </ContentView> </x:Array> </cards:CarouselView.ItemsSource> </cards:CarouselView> <!--#endregion--> <!--#region Tabs--> <CollectionView Grid.Row="2" Margin="0" HorizontalOptions="Center" HorizontalScrollBarVisibility="Always" ItemsLayout="HorizontalList" ItemsSource="{Binding ListTabOptions}" SelectionMode="Single"> <CollectionView.ItemTemplate> <DataTemplate> <Grid Margin="0" Padding="0,0" xe:Commands.Tap="{Binding BindingContext.ChangeTabCommand, Source={x:Reference HomePageParent}}" xe:Commands.TapParameter="{Binding Id}" xe:TouchEffect.Color="{StaticResource grayColor}" BackgroundColor="White"> <Grid.ColumnDefinitions> <ColumnDefinition Width="{Binding TabOptionWidth}" /> </Grid.ColumnDefinitions> <Grid Grid.Row="0" Grid.Column="0" HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand"> <Grid.ColumnDefinitions> <ColumnDefinition Width="50" /> <ColumnDefinition Width="100" /> </Grid.ColumnDefinitions> <Image Grid.Row="0" Grid.Column="0" HeightRequest="20" HorizontalOptions="EndAndExpand" IsVisible="{Binding IsSelected, Converter={StaticResource inverter}}" Source="{Binding UnselectedImage}" VerticalOptions="CenterAndExpand" /> <Image Grid.Row="0" Grid.Column="0" HeightRequest="20" HorizontalOptions="EndAndExpand" IsVisible="{Binding IsSelected}" Source="{Binding SelectedImage}" VerticalOptions="CenterAndExpand" /> <Label Grid.Row="0" Grid.Column="1" FontSize="12" HorizontalOptions="StartAndExpand" Text="{Binding Text}" TextColor="{Binding IsSelected, Converter={StaticResource color}, ConverterParameter=blueBerryColor|chaliceGrayColor}" VerticalOptions="CenterAndExpand" /> </Grid> <VisualStateManager.VisualStateGroups> <VisualStateGroup Name="CommonStates"> <VisualState Name="Normal" /> <VisualState Name="Selected"> <VisualState.Setters> <Setter Property="BackgroundColor" Value="{StaticResource whiteColor}" /> </VisualState.Setters> </VisualState> </VisualStateGroup> </VisualStateManager.VisualStateGroups> </Grid> </DataTemplate> </CollectionView.ItemTemplate> </CollectionView> <!--#endregion--> </Grid> </ContentPage.Content>
Dashboard - Content View
<ContentView x:Class="WaveTradeX.Views.DashboardPage" xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:ig="clr-namespace:Infragistics.XamarinForms.Controls.Charts;assembly=Infragistics.XF.Charts" ... > <ContentView.Content> <Grid Padding="10" BackgroundColor="#f1f2f7" ColumnSpacing="1" RowSpacing="1"> <Grid.RowDefinitions> <RowDefinition Height="auto" /> <!-- Top Bar --> <RowDefinition Height="*" /> <!-- First Row of Content --> <RowDefinition Height="*" /> <!-- Second Row of Content --> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="*" /> </Grid.ColumnDefinitions> ... <Grid Grid.Row="1" Grid.Column="0" ColumnSpacing="1" RowSpacing="1"> <Grid.RowDefinitions> <RowDefinition Height="*" /> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="2*" /> <!-- Top 10 Articles --> <ColumnDefinition Width="1.8*" /> <!-- CC --> <ColumnDefinition Width="0.85*" /> <!-- Weather --> </Grid.ColumnDefinitions> ... <material:MaterialCard Grid.Row="0" Grid.Column="1" Elevation="0" Margin="5,5,5,5"> <Grid BackgroundColor="White" ColumnSpacing="1" RowSpacing="0"> <StackLayout> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="*"/> <ColumnDefinition Width="45"/> </Grid.ColumnDefinitions> <Label Grid.Column="0" Style="{StaticResource labelCardTitle}" Text="{x:Static Lang:LangDashboard.CurrentAccount}" /> <xe:BorderView Grid.Column="1" VerticalOptions="StartAndExpand" HorizontalOptions="EndAndExpand" Background="Transparent" xe:TouchEffect.Color="{StaticResource altoGrayColor}" xe:Commands.Tap="{Binding OpenCCSnapshotCommand}"> <Image Source="{Binding IconPopup}" Margin="7" Aspect="AspectFit"/> </xe:BorderView> </Grid> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="*" /> <ColumnDefinition Width="auto" /> </Grid.ColumnDefinitions> <!-- {Binding Amount, Converter={StaticResource Currency}}" --> <!-- FormatLabel="CurrentAccountRingSeries_FormatLabel" --> <ig:XamDoughnutChart x:Name="CurrentAccountChart" Grid.Column="0" InnerExtent="70"> <ig:XamDoughnutChart.Series> <ig:RingSeries x:Name="CurrentAccountRingSeries" ItemsSource="{Binding CurrentAccountBySeniority}" LabelExtent="15" LabelMemberPath="ValueLabel" LabelInnerColor="#51667a" LabelOuterColor="#51667a" LabelsPosition="OutsideEnd" LeaderLineType="Straight" LeaderLineVisibility="Visible" Legend="{x:Reference CurrentAccountLegend}" LegendLabelMemberPath="Label" RadiusFactor="0.6" StartAngle="150" ValueMemberPath="ValueLabel" /> </ig:XamDoughnutChart.Series> </ig:XamDoughnutChart> <ig:ItemLegend x:Name="CurrentAccountLegend" Grid.Column="1" HorizontalOptions="EndAndExpand" VerticalOptions="EndAndExpand" /> </Grid> </StackLayout> </Grid> </material:MaterialCard> ... </Grid> ... </Grid> </ContentView.Content> </ContentView>
Method that is called to refresh data for the chart:
private void GetCurrentAccount() { CurrentAccountBySeniority = new ObservableCollection<GraphValue>(); CurrentAccountBySeniority.Add(DashboardHelper.GetCurrentAccountBySeniorityValues0To30()); CurrentAccountBySeniority.Add(DashboardHelper.GetCurrentAccountBySeniorityValues31To60()); CurrentAccountBySeniority.Add(DashboardHelper.GetCurrentAccountBySeniorityValues61To90()); CurrentAccountBySeniority.Add(DashboardHelper.GetCurrentAccountBySeniorityValuesMore91()); }
External Package for the Carousel View : CardsView 2.7.2