Ejemplo n.º 1
0
        private List <DateTime> GetDataForSeries(
            ICurveFitter overallCurveFitter,
            out List <double> overallSeries,
            out List <double> lastTenSeries,
            out List <double> overallTrendlineSeries)
        {
            List <DateTime> dates = new List <DateTime>();

            overallSeries          = new List <double>();
            lastTenSeries          = new List <double>();
            overallTrendlineSeries = new List <double>();

            // Get the values.
            foreach (BooksDelta delta in BooksReadProvider.BookDeltas)
            {
                double trendOverallDaysPerBook = overallCurveFitter.EvaluateYValueAtPoint(delta.DaysSinceStart);
                dates.Add(delta.Date);

                overallSeries.Add(delta.OverallTally.PercentageInTranslation);
                lastTenSeries.Add(delta.LastTenTally.PercentageInTranslation);
                overallTrendlineSeries.Add(trendOverallDaysPerBook);
            }

            return(dates);
        }
        private void GetPagesPerDayWithTimeCurveFitter(out ICurveFitter curveFitter)
        {
            List <double> xVals = new List <double>();
            List <double> yVals = new List <double>();

            foreach (BooksDelta delta in BooksReadProvider.BookDeltas)
            {
                xVals.Add(delta.DaysSinceStart);
                yVals.Add(delta.OverallTally.PageRate);
            }

            curveFitter = new QuadraticCurveFitter(xVals, yVals);
        }
Ejemplo n.º 3
0
        private void GetDaysPerBookWithTimeCurveFitter(out ICurveFitter curveFitter)
        {
            List <double> xVals = new List <double>();
            List <double> yVals = new List <double>();

            foreach (var delta in _mainModel.BookDeltas)
            {
                xVals.Add(delta.DaysSinceStart);
                yVals.Add(delta.OverallTally.DaysPerBook);
            }

            curveFitter = new QuadraticCurveFitter(xVals, yVals);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Gets the curve fitter for the trend line.
        /// </summary>
        /// <param name="curveFitter">The overall days per book curve fitter.</param>
        private void GetDaysPerBookWithTimeCurveFitter(out ICurveFitter curveFitter)
        {
            List <double> xVals = new List <double>();
            List <double> yVals = new List <double>();

            foreach (BooksDelta delta in BooksReadProvider.BookDeltas)
            {
                xVals.Add(delta.DaysSinceStart);
                yVals.Add(delta.OverallTally.DaysPerBook);
            }

            curveFitter = new LinearCurveFitter(xVals, yVals);
        }
Ejemplo n.º 5
0
        private void GetBooksInTranslationLinearCurveFitter(out ICurveFitter overallCurveFitter)
        {
            List <double> overallDays        = new List <double>();
            List <double> overallDaysPerBook = new List <double>();

            foreach (BooksDelta delta in BooksReadProvider.BookDeltas)
            {
                overallDays.Add(delta.DaysSinceStart);
                overallDaysPerBook.Add(delta.OverallTally.PercentageInTranslation);
            }

            overallCurveFitter = new LinearCurveFitter(overallDays, overallDaysPerBook);
        }
        /// <summary>
        /// Gets the curve fitters for the two trend lines.
        /// </summary>
        /// <param name="lastTenCurveFitter">The last ten curve fitter.</param>
        /// <param name="overallCurveFitter">The overall curve fitter.</param>
        private void GetAverageDaysPerBookCurveFitters(out ICurveFitter lastTenCurveFitter, out ICurveFitter overallCurveFitter)
        {
            List <double> xVals        = new List <double>();
            List <double> yValsLastTen = new List <double>();
            List <double> yValsOverall = new List <double>();

            foreach (BooksDelta delta in BooksReadProvider.BookDeltas)
            {
                xVals.Add(delta.DaysSinceStart);
                yValsLastTen.Add(delta.LastTenTally.DaysPerBook);
                yValsOverall.Add(delta.OverallTally.DaysPerBook);
            }

            lastTenCurveFitter = new QuadraticCurveFitter(xVals, yValsLastTen);
            overallCurveFitter = new QuadraticCurveFitter(xVals, yValsOverall);
        }
        private void GetPagesReadWithTimeCurveFitter(out ICurveFitter curveFitter)
        {
            List <double> xVals = new List <double>();
            List <double> yVals = new List <double>();

            DateTime start = BooksReadProvider.BookPerYearDeltas[0].Date;

            foreach (var delta in BooksReadProvider.BookPerYearDeltas)
            {
                int daysSinceStart = (delta.Date - start).Days;
                xVals.Add(daysSinceStart);
                yVals.Add(delta.OverallTally.PageRate);
            }

            curveFitter = new QuadraticCurveFitter(xVals, yVals);
        }
Ejemplo n.º 8
0
        private void GetAverageDaysPerBookCurveFitters(
            out ICurveFitter lastTenCurveFitter, out ICurveFitter overallCurveFitter)
        {
            List <double> xVals        = new List <double>();
            List <double> yValsLastTen = new List <double>();
            List <double> yValsOverall = new List <double>();

            foreach (var delta in _mainModel.BookDeltas)
            {
                xVals.Add(delta.DaysSinceStart);
                yValsLastTen.Add(delta.LastTenTally.DaysPerBook);
                yValsOverall.Add(delta.OverallTally.DaysPerBook);
            }

            //lastTenCurveFitter = new LinearCurveFitter(xVals, yValsLastTen);
            lastTenCurveFitter = new QuadraticCurveFitter(xVals, yValsLastTen);
            overallCurveFitter = new QuadraticCurveFitter(xVals, yValsOverall);
        }