/// <summary> /// /// </summary> /// <param name="serie"></param> /// <returns></returns> protected virtual SerieSet GetSerieSet(Serie serie) { var serieSet = new SerieSet() { Name = serie.Name }; var keyIndex = serie.Columns.IndexOf(KeyColumnName); var indexedKeyColumns = Enumerable.Range(0, serie.Columns.Count).ToDictionary(p => serie.Columns [p], p => p); foreach (var serieValues in serie.Values) { var serieSetItem = GetSerieSetItem(keyIndex, indexedKeyColumns, serieValues); serieSet.Series.Add(serieSetItem); } return(serieSet); }
/// <summary> /// /// </summary> /// <param name="serieSets"></param> /// <param name="serieSetItem"></param> protected virtual void BindSerieSets(List <SerieSet> serieSets, SerieSetItem serieSetItem) { var serieKeyValues = serieSetItem.Key.Split(','); var serieName = serieKeyValues.FirstOrDefault(); if (!String.IsNullOrEmpty(serieName) && !serieSets.Any(p => p.Name == serieName)) { var serieSet = new SerieSet() { Name = serieName }; serieSet.Series.Add(serieSetItem); serieSets.Add(serieSet); } else { var serieSet = serieSets.FirstOrDefault(p => p.Name == serieName); serieSet.Series.Add(serieSetItem); } }