SplineSeriesDefinition

2 posts, 0 answers
  1. Marciano
    Marciano avatar
    6 posts
    Member since:
    Jul 2010

    Posted 13 Jan 2011 Link to this post

    I'm trying make one chart with many series to compare, for example estimated vs effectived cash flow, I tried for several ways but until now I could not.

    If possible I need one example that use aggregation function (sum) and show many series with date in x axys.

    Below is more or less what I want.

    List<List<SplineChartAux>> itemsSource = new List<List<SplineChartAux>>();
                    Random r = new Random();

                    int index = 0;
                    if (MyDataGrid.GroupDescriptors.OfType<ColumnGroupDescriptor>().Count() > 0)
                    {
                        var column = MyDataGrid.GroupDescriptors.OfType<ColumnGroupDescriptor>().First();
                    
                        var ds = new List<String>();

                        var list = (this.DataSource as IEnumerable);
                        foreach (var item in list)
                        {
                            ds.Add(item.GetType().GetProperty(column.Column.UniqueName).GetValue(item, null) as string);
                        }

                        ds = ds.Distinct().ToList();

                        RadChart1.SeriesMappings.Clear();

                        foreach (var item in ds)
                        {
                            SeriesMapping sm = new SeriesMapping();
                            sm.SeriesDefinition = new SplineSeriesDefinition();
                            sm.LegendLabel = item;
                            sm.CollectionIndex = index;

                            sm.ItemMappings.Add(new ItemMapping("XValue", DataPointMember.XCategory));
                            sm.ItemMappings.Add(new ItemMapping("YValue", DataPointMember.YValue, aggFunct));

                            RadChart1.SeriesMappings.Add(sm);

                            index++;
                        }
                       
                    }


                    RadChart1.ItemsSource = itemsSource;
  2. Evgenia
    Admin
    Evgenia avatar
    1437 posts

    Posted 19 Jan 2011 Link to this post

    Hi Marciano,

    Take a look at our demo with full source code that demonstrates AggregateFunction (Sum) in action and the XAxis values are of type DateTime. For more information about Aggregation you can review our help topic - http://www.telerik.com/help/silverlight/radchart-features-grouping-and-aggregation.html

    Best wishes,
    Evgenia
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
Back to Top