Binding Exception

2 posts, 0 answers
  1. Gareth Burns
    Gareth Burns avatar
    4 posts
    Member since:
    Apr 2010

    Posted 27 Apr 2010 Link to this post

    Hi, I have just downloaded the latest trial code and I am experiencing some problems getting data to bind to a chart.

    I have setup a WPF Service which delivers data and the data is coming across to the codebehind without issue.
    When I try to bind that data to my chart I get a null exception.

    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.b__0(DependencyObject d, DependencyPropertyChangedEventArgs e) at System.Windows.DependencyObject.RaisePropertyChangeNotifications(DependencyProperty dp, Object newValue, Object oldValue) at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value, Boolean allowReadOnlySet, Boolean isSetByStyle, Boolean isSetByBuiltInStyle, PropertyInvalidationReason reason) at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value) at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value) at Telerik.Windows.Controls.RadChart.set_ItemsSource(Object value) at YomegoSMR_Silverlight.MainPage.proxy_GetStatsCompleted(Object sender, GetStatsCompletedEventArgs e)

    My Code
    void proxy_GetStatsCompleted(object sender, ServiceReference1.GetStatsCompletedEventArgs e)
            {

                var seriesMapping = new SeriesMapping();
                seriesMapping.LegendLabel = "User Types";
                seriesMapping.SeriesDefinition = new BarSeriesDefinition();

                var ymap = new ItemMapping("count", DataPointMember.YValue);
                var xmap = new ItemMapping("name", DataPointMember.XValue);

                seriesMapping.ItemMappings.Add(ymap);
                seriesMapping.ItemMappings.Add(xmap);

                myChart.SeriesMappings.Add(seriesMapping);

                myChart.ItemsSource = e.Result;

            }


    Can anyone suggest why this problem is happening. We really like the Silverlight charts but unless we can bind data dynamically from our database there is no point in using them.

    Please advise
    G
  2. Gareth Burns
    Gareth Burns avatar
    4 posts
    Member since:
    Apr 2010

    Posted 28 Apr 2010 Link to this post

    Solved this for myself. Basically I was trying to pass a string through to the XValue and it was going mental!
    Change XValue to XCategory.

    Disapointted in the error messages returned however as clearly there were no Null values being passed.

    Poor.
Back to Top