예제 #1
0
        /// <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>
        /// Handles the ZoomRectChanged event of the Surface control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void Surface_ZoomRectChanged(object sender, EventArgs e)
        {
            if (!_pending_series_collection.ToList().SelectMany(x => x).ToList().Exists(x => x.IsUpdateSeries))
            {
                List <PendingSeries> updateSeries = new List <PendingSeries>();

                foreach (var pending_Series in _to_render)
                {
                    updateSeries.Add(new PendingSeries()
                    {
                        IsUpdateSeries = true,
                        Series         = pending_Series.Value.Series,
                        XX             = new List <GraphDataPoint>(),
                        YY             = new List <GraphDataPoint>(),
                    });
                }

                _pending_series_collection.BlockEnqueue(updateSeries);
            }
        }