/// <summary> /// Submits a matrix of x and y data points. Meaning each data series should process a single collection of x/y data points. /// </summary> /// <param name="xxxx">X matrix.</param> /// <param name="yyyy">Y matrix.</param> public void PushData(IEnumerable <IEnumerable <TXDataPoint> > xxxx, IEnumerable <IEnumerable <TYDataPoint> > yyyy) { if (DataSeriesCollection.Count == 0) { return; } IEnumerable <IEnumerable <GraphDataPoint> > xxxxI = xxxx.Select(x => x.ToList()).ToList(); IEnumerable <IEnumerable <GraphDataPoint> > yyyyI = yyyy.Select(x => x.ToList()).ToList(); List <List <GraphDataPoint> > xxxxList = xxxxI.Select(x => x.ToList()).ToList(); List <List <GraphDataPoint> > yyyyList = yyyyI.Select(x => x.ToList()).ToList(); int first_count_x = xxxxList[0].Count; int first_count_y = yyyyList[0].Count; bool is_data_valid = true; for (int i = 0; i < xxxxList.Count; i++) { if (xxxxList[0].Count != first_count_x) { is_data_valid = false; break; } if (xxxxList[0].Count != yyyyList[0].Count) { is_data_valid = false; break; } } if (!is_data_valid) { throw new ArgumentOutOfRangeException("When pushing data to a multi series renderer, each series must contain the same amount of data."); } var list = DataSeriesCollection.ToList(); var pending_list = new List <PendingSeries>(); for (int i = 0; i < list.Count; i++) { pending_list.Add(new PendingSeries() { Series = list[i], XX = xxxxList[i].ToList(), YY = yyyyList[i].ToList(), }); } _pending_series_collection.BlockEnqueue(pending_list); }
/// <summary> /// Submits the specified collections of x and y data points. /// If the controller has more than one data series the data points will be distributed evenly. /// </summary> /// <param name="xx">X data point collection.</param> /// <param name="yy">Y data point collection.</param> public void PushData(IEnumerable <TXDataPoint> xx, IEnumerable <TYDataPoint> yy) { if (DataSeriesCollection.Count == 0) { return; } var xList = xx.ToList(); var yList = yy.ToList(); List <List <TXDataPoint> > xxxx = new List <List <TXDataPoint> >(); List <List <TYDataPoint> > yyyy = new List <List <TYDataPoint> >(); foreach (var series in DataSeriesCollection.ToList()) { xxxx.Add(new List <TXDataPoint>()); yyyy.Add(new List <TYDataPoint>()); } int counter = 0; for (int i = 0; i < xList.Count; i++) { xxxx[counter].Add(xList[i]); yyyy[counter].Add(yList[i]); counter++; if (counter >= xxxx.Count) { counter = 0; } } PushData(xxxx, yyyy); }
/// <summary> /// Submits the specified x and y data points. /// If the controller has more than one data series the data points will be duplicated. /// </summary> /// <param name="x">X data point.</param> /// <param name="y">Y data point.</param> public void PushData(TXDataPoint x, TYDataPoint y) { if (DataSeriesCollection.Count == 0) { return; } List <List <TXDataPoint> > xxxx = new List <List <TXDataPoint> >(); List <List <TYDataPoint> > yyyy = new List <List <TYDataPoint> >(); foreach (var series in DataSeriesCollection.ToList()) { xxxx.Add(new List <TXDataPoint>() { x }); yyyy.Add(new List <TYDataPoint>() { y }); } PushData(xxxx, yyyy); }