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

Unable to cast object of type 'System.Decimal' to type Object

1 Answer 138 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Anitha
Top achievements
Rank 1
Anitha asked on 24 Apr 2012, 01:13 PM
Hi All,

    I am trying to bind more than 4 series to the rad chart. Four series are binding perfectly, but when I am trying to bind 5th series, I am getting the below error,:

Unable to cast object of type 'System.Decimal' to type Object

   at Telerik.Windows.Data.FuncExtensions.<>c__DisplayClass1`2.<ToUntypedFunc>b__0(Object item)
   at Telerik.Windows.Controls.Charting.DataBindingHelper.ExtractDataPoint(QueryableCollectionViewGroup queryableCollectionViewGroup, AggregateFunction aggregateFunction, Func`2 getter, EmptyPointBehavior emptyPointBehavior)
   at Telerik.Windows.Controls.Charting.DataBindingHelper.ProcessNoMappings(QueryableCollectionView dataEngine, List`1 numericPropertyDescriptors, ISeriesDefinition defaultSeriesDefinition, SamplingSettings samplingSettings, ZoomScrollSettings zoomScrollSettings)
   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.Rebind()
   at Telerik.Windows.Controls.RadChart.SeriesMappingsCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
   at System.Windows.DependencyObjectCollection`1.TryCollectionChanged(NotifyCollectionChangedEventArgs e)
   at System.Windows.DependencyObjectCollection`1.RaiseReset()
   at System.Windows.DependencyObjectCollection`1.Clear()
   at SODANORTEL.MainPage.LoadGraphDown(Object s, EventArgs e)
   at SODANORTEL.MainPage.lst_Measures_Downward_SelectionChanged(Object sender, SelectionChangedEventArgs e)
   at System.Windows.Controls.Primitives.Selector.OnSelectionChanged(SelectionChangedEventArgs e)
   at System.Windows.Controls.Primitives.Selector.InvokeSelectionChanged(List`1 unselectedItems, List`1 selectedItems)
   at System.Windows.Controls.Primitives.Selector.SelectionChanger.End()
   at System.Windows.Controls.Primitives.Selector.NotifyListItemSelected(ListBoxItem listBoxItem, Boolean isSelected)
   at System.Windows.Controls.Primitives.Selector.OnIsSelectedChanged(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.SetValueInternal(DependencyProperty dp, Object value, Boolean allowReadOnlySet, Boolean isBindingInStyleSetter)
   at System.Windows.DependencyObject.SetValue(DependencyProperty property, Boolean b)
   at System.Windows.Controls.ListBox.MakeToggleSelection(Int32 index)
   at System.Windows.Controls.ListBox.HandleItemSelection(ListBoxItem item, Boolean isMouseSelection)
   at System.Windows.Controls.ListBox.OnListBoxItemClicked(ListBoxItem item)
   at System.Windows.Controls.ListBoxItem.OnMouseLeftButtonDown(MouseButtonEventArgs e)
   at System.Windows.Controls.Control.OnMouseLeftButtonDown(Control ctrl, EventArgs e)
   at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName, UInt32 flags)

Any idea why I am not able to bind more than 4 series to a line chart.

Thanks in Advance

1 Answer, 1 is accepted

Sort by
0
Petar Marchev
Telerik team
answered on 27 Apr 2012, 07:09 AM
Hello Anitha,

I created a simple app that has a chart with six line series and it works correctly. I have attached it to this response so that you can test it and let us know if you get an incorrect behavior.

I suspect that the fifth series you add has some inconsistency in the series mapping, so I suggest you check on that first. If you keep experiencing problems I will have to ask that you prepare a simple app that reproduces this exception and send the code to us so that we can test it and investigate.   

Regards,
Petar Marchev
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
Chart
Asked by
Anitha
Top achievements
Rank 1
Answers by
Petar Marchev
Telerik team
Share this question
or