This is a migrated thread and some comments may be shown as answers.

PieSeriesDefinition throwing exception on bind

6 Answers 150 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Paulius Putna
Top achievements
Rank 1
Paulius Putna asked on 23 Apr 2010, 12:54 PM
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 :(

6 Answers, 1 is accepted

Sort by
0
Paulius Putna
Top achievements
Rank 1
answered on 23 Apr 2010, 01:06 PM
Forgot to mention, that I am using Q1'10 SP1 controls.
0
Nikolay
Telerik team
answered on 27 Apr 2010, 09:42 AM
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.
0
Paulius Putna
Top achievements
Rank 1
answered on 27 Apr 2010, 11:36 AM
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.
0
Nikolay
Telerik team
answered on 29 Apr 2010, 12:19 PM
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.
0
Paulius Putna
Top achievements
Rank 1
answered on 29 Apr 2010, 01:54 PM
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...
0
Ves
Telerik team
answered on 04 May 2010, 09:33 AM
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.
Tags
Chart
Asked by
Paulius Putna
Top achievements
Rank 1
Answers by
Paulius Putna
Top achievements
Rank 1
Nikolay
Telerik team
Ves
Telerik team
Share this question
or