Multiple Lines on a line chart.

4 posts, 0 answers
  1. Saaed Bhatti
    Saaed Bhatti avatar
    4 posts
    Member since:
    Oct 2012

    Posted 15 Dec 2009 Link to this post

    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;

     

    }
  2. Ves
    Admin
    Ves avatar
    2926 posts

    Posted 18 Dec 2009 Link to this post

    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.
  3. Saaed Bhatti
    Saaed Bhatti avatar
    4 posts
    Member since:
    Oct 2012

    Posted 18 Dec 2009 Link to this post

    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.
  4. Bartholomeo Rocca
    Bartholomeo Rocca avatar
    247 posts
    Member since:
    May 2006

    Posted 18 Dec 2009 Link to this post

    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.
Back to Top