Esempio n. 1
0
        void HandleMovingAverageRequested(object sender, MovingAverageRequestedEventArgs e)
        {
            // Create the moving average values
            var movingAverage = _chartData
                                .Window(e.NumberOfDays, window => {
                return(new ChartDataPoint()
                {
                    XValue = window.Last().XValue,
                    YValue = window.Select(dp => dp.YValue).Average()
                });
            })
                                .ToList();

            // Send the result back to the the view
            _view.UpdateChartWithMovingAverage(movingAverage);
        }
        void HandleMovingAverageRequested(object sender, MovingAverageRequestedEventArgs e)
        {
            // Create the moving average values
            var movingAverage = _chartData
                .Window (e.NumberOfDays, window => {
                    return new ChartDataPoint () {
                        XValue = window.Last ().XValue,
                        YValue = window.Select (dp => dp.YValue).Average ()
                    };
                })
                .ToList ();

            // Send the result back to the the view
            _view.UpdateChartWithMovingAverage (movingAverage);
        }