This question is locked. New answers and comments are not allowed.
Hello,
I've recently stumbled upon a problem which is, I'm trying to use my own Custom Class in binding to use as the source for my Dynamic Chart's Series Provider. Problem is that it does not work and shows, "No Data found" displayed. When I try to convert the data instead and use a List<List<object>>, the data is displayed properly..
But due to various reasons, one of which is using a class parameter to specify the kind of SeriesDescriptor to use using a SeriesDescriptorSelector, I need to use my custom Class.
Here is my code below of my Classes:
And here is my code-behind (see formatted block for my conversion into List<List<object>>):
Hope you can help me! Thank you!
I've recently stumbled upon a problem which is, I'm trying to use my own Custom Class in binding to use as the source for my Dynamic Chart's Series Provider. Problem is that it does not work and shows, "No Data found" displayed. When I try to convert the data instead and use a List<List<object>>, the data is displayed properly..
But due to various reasons, one of which is using a class parameter to specify the kind of SeriesDescriptor to use using a SeriesDescriptorSelector, I need to use my custom Class.
Here is my code below of my Classes:
public class ChartData { public string ID { get; set; } public string TileID { get; set; } public string Title { get; set; } public string XAxisLabel { get; set; } public string YAxisLabel { get; set; } public List<ChartGroup> Groups = new List<ChartGroup>(); public List<string> GroupIDList = new List<string>(); public ChartData(string parID, string parTileID, string parTitle, string parXLabel, string parYLabel) { ID = parID; TileID = parTileID; Title = parTitle; XAxisLabel = parXLabel; YAxisLabel = parYLabel; Groups = new List<ChartGroup>(); GroupIDList = new List<string>(); } } public class ChartGroup { public List<ChartRow> Rows {get;set;} public ChartGroup() { Rows = new List<ChartRow>(); } } public class ChartRow { public double Value { get; set; } public string Name { get; set; } public ChartRow( string parName, double parCount) { Value = parCount; Name = parName; } }And here is my code-behind (see formatted block for my conversion into List<List<object>>):
Style seriesstyle = new Style(typeof(BarSeries)); seriesstyle.Setters.Add(new Setter(BarSeries.CombineModeProperty, Telerik.Charting.ChartSeriesCombineMode.Stack)); CategoricalSeriesDescriptor seriesdescriptor = new CategoricalSeriesDescriptor(); seriesdescriptor.ValuePath = "Value"; seriesdescriptor.CategoryPath = "Name"; seriesdescriptor.Style = seriesstyle; sourceChart.SeriesProvider.SeriesDescriptors.Add(seriesdescriptor); //HERE IS CODE BEHIND FOR CONVERSION INTO LIST<LIST<OBJECT>> //List<List<ChartRow>> groups = new List<List<ChartRow>>(); //for (int i = 0; i < ((ChartData)source.Data).Groups.Count; i++) //{ // groups.Add(new List<ChartRow>()); //for (int j = 0; j < ((ChartData)source.Data).Groups[i].Rows.Count; j++) // { //groups[i].Add(((ChartData)source.Data).Groups[i].Rows[j]); //} // } //sourceChart.SeriesProvider.Source = groups; sourceChart.SeriesProvider.Source = ((ChartData)source.Data).Groups; // <-- using this does not workHope you can help me! Thank you!