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

Unable to add ItemMapping to SeriesMapping

2 Answers 80 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Jeremy
Top achievements
Rank 1
Jeremy asked on 03 Dec 2010, 07:13 AM
Hi

I have started creating a line chart in a new project using the following code and I get a weird error trying to add an ItemMapping to a SeriesMapping object. I had the chart working successfully with a DataSeries object, but I need to change to SeriesMapping apparently to use zoom + scroll properly.
The error is: 'Telerik.Windows.Controls.Charting.ItemMappingCollection' does not contain a definition for 'seriesmap1' and no extension method 'seriesmap1' accepting a first argument of type 'Telerik.Windows.Controls.Charting.ItemMappingCollection' could be found (are you missing a using directive or an assembly reference?)  and is thrown on the last 2 lines below.
SeriesMapping seriesmap1 = new SeriesMapping();
seriesmap1.SeriesDefinition = new LineSeriesDefinition();
seriesmap1.SeriesDefinition.Appearance.Stroke = new SolidColorBrush(Colors.Red);
seriesmap1.SeriesDefinition.Appearance.PointMark.Fill = new SolidColorBrush(Colors.Transparent);
seriesmap1.SeriesDefinition.Appearance.PointMark.Stroke = new SolidColorBrush(Colors.Transparent);
seriesmap1.SeriesDefinition.ShowItemLabels = false;
ItemMapping yMapping = new ItemMapping("NumberOfPeople", DataPointMember.YValue);
ItemMapping xMapping = new ItemMapping("Height", DataPointMember.XValue);
seriesmap1.ItemMappings.Add(yMapping);
seriesmap1.ItemMappings.Add(xMapping);

What am I doing wrong?

2 Answers, 1 is accepted

Sort by
0
Jeremy
Top achievements
Rank 1
answered on 06 Dec 2010, 02:54 AM
Worked it out! I changed the Target Silverlight Version in the project properties from Silverlight 3 to Silverlight 4 :)
0
Accepted
Yavor
Telerik team
answered on 07 Dec 2010, 08:00 AM
Hi Jeremy,

I am glad that you pinpointed the cause of the problem. I hope the sample is working as per your requirements now. If further questions arise, let us know.

All the best,
Yavor
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
Tags
Chart
Asked by
Jeremy
Top achievements
Rank 1
Answers by
Jeremy
Top achievements
Rank 1
Yavor
Telerik team
Share this question
or