/// <summary> /// Process the series to build the chart data structure. /// </summary> /// <param name="dataset">The dataset.</param> /// <returns>Data series</returns> protected virtual ISeries CreateSeries(DataStream dataset) { var xI = dataset.FieldNames.IndexOf("x"); var yI = dataset.FieldNames.IndexOf("y"); var wI = dataset.FieldNames.IndexOf("w"); var hI = dataset.FieldNames.IndexOf("h"); var x = new List <TReal>(); var y = new List <TReal>(); var w = new List <TReal>(); var h = new List <TReal>(); //var atts = new List<object>(); //var nameIndices = Enumerable.Range(0, dataset.FieldNames.Count).Except(new[] { xI, yI, wI, hI }).ToArray(); foreach (var dataStreamValue in dataset.Stream) { //atts.AddRange(from c in nameIndices select dataStreamValue.Values[c]); x.Add((TReal)dataStreamValue.Values[xI]); y.Add((TReal)dataStreamValue.Values[yI]); w.Add((TReal)dataStreamValue.Values[wI]); h.Add((TReal)dataStreamValue.Values[hI]); } var series = new Series1(x, y, w, h); //var names = nameIndices.Select(i => dataset.FieldNames[i]).ToArray(); //var types = nameIndices.Select(i => dataset.FieldTypes[i]).ToArray(); //var series = new Series2(x, y, w, h, names, types, atts); var adapter = new RectangleRenderableSeries(series); chart.RenderableSeries.Add(adapter); brd.Visibility = Visibility.Collapsed; return(series); }
/// <summary> /// Process the series to build the chart data structure. /// </summary> /// <param name="dataset">The dataset.</param> /// <returns>Data series</returns> protected virtual ISeries CreateSeries(DataStream dataset) { var xI = dataset.FieldNames.IndexOf("x"); var yI = dataset.FieldNames.IndexOf("y"); var wI = dataset.FieldNames.IndexOf("w"); var hI = dataset.FieldNames.IndexOf("h"); var x = new List<TReal>(); var y = new List<TReal>(); var w = new List<TReal>(); var h = new List<TReal>(); //var atts = new List<object>(); //var nameIndices = Enumerable.Range(0, dataset.FieldNames.Count).Except(new[] { xI, yI, wI, hI }).ToArray(); foreach (var dataStreamValue in dataset.Stream) { //atts.AddRange(from c in nameIndices select dataStreamValue.Values[c]); x.Add((TReal)dataStreamValue.Values[xI]); y.Add((TReal)dataStreamValue.Values[yI]); w.Add((TReal)dataStreamValue.Values[wI]); h.Add((TReal)dataStreamValue.Values[hI]); } var series = new Series1(x, y, w, h); //var names = nameIndices.Select(i => dataset.FieldNames[i]).ToArray(); //var types = nameIndices.Select(i => dataset.FieldTypes[i]).ToArray(); //var series = new Series2(x, y, w, h, names, types, atts); var adapter = new RectangleRenderableSeries(series); chart.RenderableSeries.Add(adapter); brd.Visibility = Visibility.Collapsed; return series; }