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

SplineSeriesDefinition

1 Answer 44 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Marciano
Top achievements
Rank 1
Marciano asked on 14 Jan 2011, 04:07 AM
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;

1 Answer, 1 is accepted

Sort by
0
Evgenia
Telerik team
answered on 19 Jan 2011, 04:13 PM
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>>
Tags
Chart
Asked by
Marciano
Top achievements
Rank 1
Answers by
Evgenia
Telerik team
Share this question
or