This is a migrated thread and some comments may be shown as answers.
Binding Exception
1 Answer 26 Views
This is a migrated thread and some comments may be shown as answers.
Gareth Burns
Top achievements
Rank 1
Gareth Burns asked on 27 Apr 2010, 05:55 PM
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.

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

1 Answer, 1 is accepted

Sort by
0
Gareth Burns
Top achievements
Rank 1
answered on 28 Apr 2010, 11:19 AM
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.
Tags
Chart
Asked by
Gareth Burns
Top achievements
Rank 1
Answers by
Gareth Burns
Top achievements
Rank 1
Share this question
or