PieSeriesDefinition throwing exception on bind

7 posts, 0 answers
  1. Paulius Putna
    Paulius Putna avatar
    16 posts
    Member since:
    Feb 2010

    Posted 23 Apr 2010 Link to this post

    I updated my Silverlight 4 application with latest controls and my charts using Pie3DSeriesDefinition (tried 2d with same results) throwing this exception:

    Object reference not set to an instance of an object.  

    Stack Trace:
    at Telerik.Windows.Controls.Charting.DataBindingHelper.AssignMappingFieldTypes(QueryableCollectionView dataEngine, SeriesMapping seriesMapping) 
    at Telerik.Windows.Controls.Charting.DataBindingHelper.ProcessNoGrouping(SeriesMapping seriesMapping, QueryableCollectionView dataEngine, Int32 samplingThreshold, ZoomScrollSettings zoomScrollSettings, ISeriesDefinition defaultSeriesDefinition, AxisRangeState axisXRangeState, Int32 seriesCount) 
    at Telerik.Windows.Controls.Charting.DataBindingHelper.ProcessMapping(SeriesMapping seriesMapping, QueryableCollectionView dataEngine, Int32 samplingThreshold, ZoomScrollSettings zoomScrollSettings, ISeriesDefinition defaultSeriesDefinition, AxisRangeState axisXRangeState, Int32 seriesCount) 
    at Telerik.Windows.Controls.Charting.DataBindingHelper.ProcessMappings(SeriesMappingCollection seriesMappings, QueryableCollectionView dataEngine, Int32 samplingThreshold, ZoomScrollSettings zoomScrollSettings, ISeriesDefinition defaultSeriesDefinition, AxisRangeState axisXRangeState) 
    at Telerik.Windows.Controls.Charting.DataBindingHelper.GenerateDataSeries(Object originalData, SeriesMappingCollection seriesMappings, ISeriesDefinition defaultSeriesDefinition, ChartFilterDescriptorCollection globalFilterDescriptors, ChartSortDescriptorCollection globalSortDescriptors, SamplingSettings samplingSettings, ZoomScrollSettings zoomScrollSettings, AxisRangeState axisXRangeState) 
    at Telerik.Windows.Controls.RadChart.GenerateDataSeries(Object originalData, SeriesMappingCollection seriesMappings, ChartArea chartArea) 
    at Telerik.Windows.Controls.RadChart.GenerateDataSeries(Object originalData) 
    at Telerik.Windows.Controls.RadChart.Rebind(Object originalData) 
    at Telerik.Windows.Controls.RadChart.ItemsSourcePropertyChanged(DependencyObject target, DependencyPropertyChangedEventArgs args) 
    at Telerik.Windows.PropertyMetadata.<>c__DisplayClass1.<Create>b__0(DependencyObject d, DependencyPropertyChangedEventArgs e) 
    at System.Windows.DependencyObject.RaisePropertyChangeNotifications(DependencyProperty dp, Object oldValue, Object newValue) 
    at System.Windows.DependencyObject.UpdateEffectiveValue(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, ValueOperation operation) 
    at System.Windows.DependencyObject.RefreshExpression(DependencyProperty dp) 
    at System.Windows.Data.BindingExpression.SendDataToTarget() 
    at System.Windows.Data.BindingExpression.SourcePropertyChanged(PropertyPathListener sender, PropertyPathChangedEventArgs args) 
    at System.Windows.PropertyPathListener.RaisePropertyPathStepChanged(PropertyPathStep source) 
    at System.Windows.PropertyAccessPathStep.RaisePropertyPathStepChanged(PropertyListener source) 
    at System.Windows.CLRPropertyListener.SourcePropertyChanged(Object sender, PropertyChangedEventArgs args) 
    at System.Windows.Data.WeakPropertyChangedListener.PropertyChangedCallback(Object sender, PropertyChangedEventArgs args) 
    at System.ComponentModel.PropertyChangedEventHandler.Invoke(Object sender, PropertyChangedEventArgs e) 
    at Gideon.Data.ViewModelBase.OnPropertyChanged(String propertyName) 
    at Gideon.Models.MainViewModel.set_DirectionShippments(ObservableCollection`1 value) 
    at Gideon.Models.MainViewModel.FillChartData() 
    at Gideon.Models.MainViewModel.GetTransactionsComplete(LoadOperation`1 transactions) 
    at Gideon.Models.MainViewModel.<FilterShippments>b__19(LoadOperation`1 o) 
    at System.ServiceModel.DomainServices.Client.DomainContext.<>c__DisplayClass13`1.<Load>b__11(LoadOperation lo) 
    at System.ServiceModel.DomainServices.Client.LoadOperation.<>c__DisplayClass4`1.<Create>b__0(LoadOperation`1 arg) 
    at System.ServiceModel.DomainServices.Client.LoadOperation`1.InvokeCompleteAction() 
    at System.ServiceModel.DomainServices.Client.OperationBase.Complete(Object result) 
    at System.ServiceModel.DomainServices.Client.LoadOperation.Complete(DomainClientResult result) 
    at System.ServiceModel.DomainServices.Client.DomainContext.CompleteLoad(IAsyncResult asyncResult) 
    at System.ServiceModel.DomainServices.Client.DomainContext.<>c__DisplayClass1b.<Load>b__17(Object ) 



    The code:

    foreach (var c in directionShipmentsDictionary) 
        directionShipments.Add(new DataPoint { YValue = c.Value }); 

    DirectionShipments is an ObservableCollection

    C#:
    SeriesMapping sm4 = new SeriesMapping(); 
    sm4.ChartArea = this.directionShippments; 
    sm4.SeriesDefinition = new Pie3DSeriesDefinition(); 
    sm4.SeriesDefinition.ShowItemToolTips = true
    sm4.SeriesDefinition.SeriesItemLabelStyle = App.Current.Resources["SeriesItemLabelStyle"as Style; 
    sm4.ItemMappings.Add(new ItemMapping("YValue", DataPointMember.YValue)); 
    sm4.ItemMappings.Add(new ItemMapping("Label", DataPointMember.Label)); 
    sm3.ItemMappings.Add(new ItemMapping("Tooltip", DataPointMember.Tooltip)); 

    XAML:
    <chart:RadChart x:Name="transChart3"ItemsSource="{Binding DirectionShippments}" Background="Transparent" BorderThickness="0" UseDefaultLayout="False" FontSize="28"
        <charting:ChartArea Grid.Column="0" x:Name="directionShippments" FontSize="28" Foreground="Black"/> 
    </chart:RadChart> 

    I am not too sure on what to do. Frankly it is a bit annoying, because after each update something brakes :(
  2. Paulius Putna
    Paulius Putna avatar
    16 posts
    Member since:
    Feb 2010

    Posted 23 Apr 2010 Link to this post

    Forgot to mention, that I am using Q1'10 SP1 controls.
  3. Nikolay
    Admin
    Nikolay avatar
    397 posts

    Posted 27 Apr 2010 Link to this post

    Hello Paulius Putna,

    Thank you for your interest in our controls.

    Please, take a look at the attached sample project, which works OK on our side. Note that RadChart does not support displaying tooltips of 3D series in Silverlight, so as long as you're using Pie3DSeriesDefinition, ShowItemToolTips would not work ( until you switch to a 2D series type, such as PieSeriesDefinition ).

    One possible reason why you could get the NullReference exception would be if you haven't defined a 'tooltip' property in your DataObject and then try mapping it to a DataPointMember.

    I hope reviewing the attached sample app would help you find a solution.If you have further questions, please, do not hesitate to contact us.

    Greetings,
    Nikolay
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  4. Paulius Putna
    Paulius Putna avatar
    16 posts
    Member since:
    Feb 2010

    Posted 27 Apr 2010 Link to this post

    I am still getting a NullRefferenceException, but with no stack trace. I tried all the tips you gave me and nothing works. I moved to DoghnutSeriesDefinition, but hopefully you can give me some more clues on what could be wrong.
  5. Nikolay
    Admin
    Nikolay avatar
    397 posts

    Posted 29 Apr 2010 Link to this post

    Hi Paulius Putna,

    Could you, please, create a small sample application, or modify the one I sent you, so that the issue could be reproduced and send it to us.This way our developers would be able to debug it and provide a more accurate and thorough information in order to help you resolve it.

    Looking forward to your reply.

    Best wishes,
    Nikolay
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  6. Paulius Putna
    Paulius Putna avatar
    16 posts
    Member since:
    Feb 2010

    Posted 29 Apr 2010 Link to this post

    I tried reproducing it on your sample when you sent me, but I was unable... It was really weird because once I made my code identical to yours it was still throwing exceptions.

    Now when I think of it, maybe it had something to do with the data being not integer...
  7. Ves
    Admin
    Ves avatar
    2926 posts

    Posted 04 May 2010 Link to this post

    Hello Paulius,

    I just checked Nikolay's example with double values. It works as expected -- DataPoint.YValue is of type double so having integers or doubles should not be the reason for this. As there used be a similar problem in Q1 version, I would suggest double-checking the assemblies version - it should be 2010.1.422.1040 (or .1030 for Silverlight 3).

    Kind regards,
    Ves
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Back to Top