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

Multiple Lines on a line chart.

3 Answers 96 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Saaed Bhatti
Top achievements
Rank 1
Saaed Bhatti asked on 15 Dec 2009, 06:50 PM
How can I show multiple lines on a line control? They way I have it setup, it showes all the lines but draws them all based on the last data provided.

basically this is what I have

foreach

 

(var item in coll)

 

{
 

 

SeriesMapping seriesMapping = new SeriesMapping();

 

 

ItemMapping itemMapping = new ItemMapping();

 

 

ItemMapping itemMapping2 = new ItemMapping();

 

 

// StackedSpline Chart

 

seriesMapping =

new SeriesMapping();

 

seriesMapping.SeriesDefinition =

new StackedSplineSeriesDefinition();

 

seriesMapping.LegendLabel = pt.PlanName;

itemMapping =

new ItemMapping();

 

itemMapping.DataPointMember =

DataPointMember.YValue;

 

itemMapping.FieldName =

"Count";

 

seriesMapping.ItemMappings.Add(itemMapping);

 

 

ItemMapping itemMapping3 = new ItemMapping();

 

itemMapping3.DataPointMember =

DataPointMember.XCategory;

 

itemMapping3.FieldName =

"Name";

 

 

seriesMapping.ItemMappings.Add(itemMapping3);

 

 

this.chartPlanCaseCount.SeriesMappings.Add(seriesMapping);

 

 

 

 


this
.chartPlanCaseCount.ItemsSource = item;

 

}

3 Answers, 1 is accepted

Sort by
0
Ves
Telerik team
answered on 18 Dec 2009, 10:20 AM
Hi Saaed Bhatti,

It seems that for all the SeriesMappings you add an ItemMapping for YValue with FieldName set to "Count", so you will get all the series showing the data from the "Count" property/column.

Just a side note -- you can move the ItemsSource assignment outside the loop.

Best regards,
Ves
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Saaed Bhatti
Top achievements
Rank 1
answered on 18 Dec 2009, 04:01 PM
Hey Ves,
Thanks for your response.

If I want to show 6 series, won't have i have to set the itemsource 6 times as well? How will it map the data to the series being drawn on the map?

Thanks
Saaed.
0
Bartholomeo Rocca
Top achievements
Rank 1
answered on 18 Dec 2009, 05:03 PM
Hello Saaed,

You can find a thorough description of the databinding capabilities provided by RadChart here: http://www.telerik.com/help/silverlight/radchart-populating-with-data-data-binding-support-overview.html. I think you will find it useful.


Greetings,
Bart.
Tags
Chart
Asked by
Saaed Bhatti
Top achievements
Rank 1
Answers by
Ves
Telerik team
Saaed Bhatti
Top achievements
Rank 1
Bartholomeo Rocca
Top achievements
Rank 1
Share this question
or