private PlotModel SetupOverallBookAndPageTalliesPlot() { // Create the plot model var newPlot = new PlotModel { Title = "Overall Book And Pages Plot" }; OxyPlotUtilities.SetupPlotLegend(newPlot, "Overall Book And Pages Plot"); SetupOverallBookAndPagesVsTimeAxes(newPlot); // create series and add them to the plot LineSeries booksReadSeries; LineSeries booksReadTrendlineSeries; OxyPlotUtilities.CreateLineSeries(out booksReadSeries, ChartAxisKeys.DateKey, ChartAxisKeys.BooksReadKey, "Total Books Read", 1); OxyPlotUtilities.CreateLineSeries(out booksReadTrendlineSeries, ChartAxisKeys.DateKey, ChartAxisKeys.BooksReadKey, "Books Read Trendline", 4); double yinterceptBooks; double slopeBooks; GetBooksLinearTrendlineParameters(out yinterceptBooks, out slopeBooks); LineSeries pagesReadSeries; LineSeries pagesReadTrendlineSeries; OxyPlotUtilities.CreateLineSeries(out pagesReadSeries, ChartAxisKeys.DateKey, ChartAxisKeys.PagesReadKey, "Total Pages Read", 0); OxyPlotUtilities.CreateLineSeries(out pagesReadTrendlineSeries, ChartAxisKeys.DateKey, ChartAxisKeys.PagesReadKey, "Pages Read Trendline", 3 ); double yinterceptPages; double slopePages; GetPagesLinearTrendlineParameters(out yinterceptPages, out slopePages); foreach (var delta in _mainModel.BookDeltas) { double trendBooks = yinterceptBooks + (slopeBooks * delta.DaysSinceStart); double trendPages = yinterceptPages + (slopePages * delta.DaysSinceStart); booksReadSeries.Points.Add( new DataPoint(DateTimeAxis.ToDouble(delta.Date), delta.OverallTally.TotalBooks)); booksReadTrendlineSeries.Points.Add( new DataPoint(DateTimeAxis.ToDouble(delta.Date), trendBooks)); pagesReadSeries.Points.Add( new DataPoint(DateTimeAxis.ToDouble(delta.Date), delta.OverallTally.TotalPages)); pagesReadTrendlineSeries.Points.Add( new DataPoint(DateTimeAxis.ToDouble(delta.Date), trendPages)); } OxyPlotUtilities.AddLineSeriesToModel(newPlot, new LineSeries[] { booksReadSeries, booksReadTrendlineSeries, pagesReadSeries, pagesReadTrendlineSeries } ); // finally update the model with the new plot return(newPlot); }
private static void AddLineSeriesForMonthlyTallies(PlotModel newPlot, Dictionary<int, List<MonthOfYearTally>> bookListsByMonthOfYear) { int colourIndex = 1; var colours = OxyPlotUtilities.SetupStandardColourSet(); foreach (var year in bookListsByMonthOfYear.Keys.ToList().OrderBy(x => x)) { LineSeries booksReadSeries; LineSeries pagesReadSeries; GetBooksAndPagesReadLineSeries(colourIndex, colours, year, out booksReadSeries, out pagesReadSeries); // add the points for the days of this year foreach (var tally in bookListsByMonthOfYear[year]) { booksReadSeries.Points.Add( new DataPoint(tally.MonthOfYear, tally.BooksReadThisMonth)); pagesReadSeries.Points.Add( new DataPoint(tally.MonthOfYear, tally.PagesReadThisMonth)); } // then add them to the model OxyPlotUtilities.AddLineSeriesToModel(newPlot, new[] { booksReadSeries, pagesReadSeries }); colourIndex++; } }
private PlotModel SetupAverageDaysPerBookPlot() { // Create the plot model var newPlot = new PlotModel { Title = "Average Days Per Book Plot" }; OxyPlotUtilities.SetupPlotLegend(newPlot, "Average Days Per Book Plot"); SetupDaysPerBookVsTimeAxes(newPlot); // create series and add them to the plot LineSeries overallSeries; LineSeries lastTenSeries; LineSeries overallTrendlineSeries; LineSeries lastTenTrendlineSeries; OxyPlotUtilities.CreateLineSeries(out overallSeries, ChartAxisKeys.DateKey, ChartAxisKeys.DaysPerBookKey, "Overall", 1); OxyPlotUtilities.CreateLineSeries(out overallTrendlineSeries, ChartAxisKeys.DateKey, ChartAxisKeys.DaysPerBookKey, "Overall Trendline", 4); OxyPlotUtilities.CreateLineSeries(out lastTenSeries, ChartAxisKeys.DateKey, ChartAxisKeys.DaysPerBookKey, "Last 10", 0); OxyPlotUtilities.CreateLineSeries(out lastTenTrendlineSeries, ChartAxisKeys.DateKey, ChartAxisKeys.DaysPerBookKey, "Last 10 Trendline", 3); ICurveFitter lastTenCurveFitter; ICurveFitter overallCurveFitter; GetAverageDaysPerBookCurveFitters(out lastTenCurveFitter, out overallCurveFitter); foreach (var delta in _mainModel.BookDeltas) { double trendOverallDaysPerBook = overallCurveFitter.EvaluateYValueAtPoint(delta.DaysSinceStart); double trendLastTenDaysPerBook = lastTenCurveFitter.EvaluateYValueAtPoint(delta.DaysSinceStart); overallSeries.Points.Add( new DataPoint(DateTimeAxis.ToDouble(delta.Date), delta.OverallTally.DaysPerBook)); lastTenSeries.Points.Add( new DataPoint(DateTimeAxis.ToDouble(delta.Date), delta.LastTenTally.DaysPerBook)); overallTrendlineSeries.Points.Add( new DataPoint(DateTimeAxis.ToDouble(delta.Date), trendOverallDaysPerBook)); lastTenTrendlineSeries.Points.Add( new DataPoint(DateTimeAxis.ToDouble(delta.Date), trendLastTenDaysPerBook)); } OxyPlotUtilities.AddLineSeriesToModel(newPlot, new LineSeries[] { overallSeries, lastTenSeries, overallTrendlineSeries, lastTenTrendlineSeries } ); // finally update the model with the new plot return(newPlot); }
/// <summary> /// Sets up the plot model to be displayed. /// </summary> /// <returns>The plot model.</returns> protected override PlotModel SetupPlot() { // Create the plot model var newPlot = new PlotModel { Title = "% Books In Translation" }; OxyPlotUtilities.SetupPlotLegend(newPlot, "% Books In Translation"); SetupBooksInTranslationVsTimeAxes(newPlot); // create series and add them to the plot LineSeries overallSeries; LineSeries lastTenSeries; LineSeries overallTrendlineSeries; OxyPlotUtilities.CreateLineSeries(out overallSeries, ChartAxisKeys.DateKey, ChartAxisKeys.BooksInTranslationKey, "Overall", 1); OxyPlotUtilities.CreateLineSeries(out lastTenSeries, ChartAxisKeys.DateKey, ChartAxisKeys.BooksInTranslationKey, "Last 10", 0); OxyPlotUtilities.CreateLineSeries(out overallTrendlineSeries, ChartAxisKeys.DateKey, ChartAxisKeys.BooksInTranslationKey, "Overall Trendline", 4); double yintercept; double slope; GetBooksInTranslationLinearTrendlineParameters(out yintercept, out slope); foreach (var delta in BooksReadProvider.BookDeltas) { double trendDaysPerBook = yintercept + (slope * delta.DaysSinceStart); overallSeries.Points.Add( new DataPoint(DateTimeAxis.ToDouble(delta.Date), delta.OverallTally.PercentageInTranslation)); lastTenSeries.Points.Add( new DataPoint(DateTimeAxis.ToDouble(delta.Date), delta.LastTenTally.PercentageInTranslation)); overallTrendlineSeries.Points.Add( new DataPoint(DateTimeAxis.ToDouble(delta.Date), trendDaysPerBook)); } OxyPlotUtilities.AddLineSeriesToModel(newPlot, new[] { overallSeries, lastTenSeries, overallTrendlineSeries } ); // finally update the model with the new plot return(newPlot); }
private PlotModel SetupPagesPerBookPlot() { // Create the plot model var newPlot = new PlotModel { Title = "Pages Per Book Plot" }; OxyPlotUtilities.SetupPlotLegend(newPlot, "Pages Per Book Plot"); SetupPagesPerBookVsTimeAxes(newPlot); // create series and add them to the plot LineSeries overallSeries; LineSeries lastTenSeries; LineSeries overallTrendlineSeries; OxyPlotUtilities.CreateLineSeries(out overallSeries, ChartAxisKeys.DateKey, ChartAxisKeys.PagesPerBookKey, "Overall", 1); OxyPlotUtilities.CreateLineSeries(out lastTenSeries, ChartAxisKeys.DateKey, ChartAxisKeys.PagesPerBookKey, "Last 10", 0); OxyPlotUtilities.CreateLineSeries(out overallTrendlineSeries, ChartAxisKeys.DateKey, ChartAxisKeys.PagesPerBookKey, "Overall Trendline", 4); double yintercept; double slope; GetPagesPerBookLinearTrendlineParameters(out yintercept, out slope); foreach (var delta in _mainModel.BookDeltas) { double trendPageRate = yintercept + (slope * delta.DaysSinceStart); overallSeries.Points.Add( new DataPoint(DateTimeAxis.ToDouble(delta.Date), delta.OverallTally.PagesPerBook)); lastTenSeries.Points.Add( new DataPoint(DateTimeAxis.ToDouble(delta.Date), delta.LastTenTally.PagesPerBook)); overallTrendlineSeries.Points.Add( new DataPoint(DateTimeAxis.ToDouble(delta.Date), trendPageRate)); } OxyPlotUtilities.AddLineSeriesToModel(newPlot, new LineSeries[] { overallSeries, lastTenSeries, overallTrendlineSeries } ); // finally update the model with the new plot return(newPlot); }
/// <summary> /// Sets up the plot model to be displayed. /// </summary> /// <returns>The plot model.</returns> protected override PlotModel SetupPlot() { // Create the plot model var newPlot = new PlotModel { Title = "Longitude With Time Plot" }; OxyPlotUtilities.SetupPlotLegend(newPlot, "Longitude With Time Plot"); SetupLongitudeVsTimeAxes(newPlot); // create series and add them to the plot LineSeries overallSeries; LineSeries lastTenSeries; LineSeries overallTrendlineSeries; OxyPlotUtilities.CreateLineSeries(out overallSeries, ChartAxisKeys.DateKey, ChartAxisKeys.LongitudeKey, "Overall", 1); OxyPlotUtilities.CreateLineSeries(out lastTenSeries, ChartAxisKeys.DateKey, ChartAxisKeys.LongitudeKey, "Last 10", 0); OxyPlotUtilities.CreateLineSeries(out overallTrendlineSeries, ChartAxisKeys.DateKey, ChartAxisKeys.LongitudeKey, "Overall Trendline", 4); double yintercept; double slope; GetLongitudeLinearTrendlineParameters(out yintercept, out slope); foreach (var delta in BooksReadProvider.BookLocationDeltas) { double trendPageRate = yintercept + (slope * delta.DaysSinceStart); overallSeries.Points.Add( new DataPoint(DateTimeAxis.ToDouble(delta.Date), delta.AverageLongitude)); lastTenSeries.Points.Add( new DataPoint(DateTimeAxis.ToDouble(delta.Date), delta.AverageLongitudeLastTen)); overallTrendlineSeries.Points.Add( new DataPoint(DateTimeAxis.ToDouble(delta.Date), trendPageRate)); } OxyPlotUtilities.AddLineSeriesToModel(newPlot, new[] { overallSeries, lastTenSeries, overallTrendlineSeries }); // finally update the model with the new plot return(newPlot); }
private PlotModel SetupTalliesPerCalendarYearPlot() { // Create the plot model var newPlot = new PlotModel { Title = "Tallies Per Calendar Year Plot" }; OxyPlotUtilities.SetupPlotLegend(newPlot, "Tallies Per Calendar Year Plot"); SetupBookAndPagesVsDayOfYearAxes(newPlot); // get the books & pages read for each calendar year Dictionary <int, List <DayOfYearTally> > bookListsByDayandYear = GetBookListsByDayAndYear(); // add a series for each year (in order) int colourIndex = 1; var colours = OxyPlotUtilities.SetupStandardColourSet(); foreach (var year in bookListsByDayandYear.Keys.ToList().OrderBy(x => x)) { LineSeries booksReadSeries; LineSeries pagesReadSeries; GetBooksAndPagesReadLineSeries(colourIndex, colours, year, out booksReadSeries, out pagesReadSeries); // add the points for the days of this year foreach (var tally in bookListsByDayandYear[year]) { booksReadSeries.Points.Add( new DataPoint(tally.DayOfYear, tally.BooksReadThisYearOnThisDay)); pagesReadSeries.Points.Add( new DataPoint(tally.DayOfYear, tally.PagesReadThisYearOnThisDay)); } // then add them to the model OxyPlotUtilities.AddLineSeriesToModel(newPlot, new LineSeries[] { booksReadSeries, pagesReadSeries }); colourIndex++; } // finally update the model with the new plot return(newPlot); }
/// <summary> /// Sets up the plot model to be displayed. /// </summary> /// <returns>The plot model.</returns> protected override PlotModel SetupPlot() { // Create the plot model PlotModel newPlot = new PlotModel { Title = "Days Per Book With Time Plot" }; OxyPlotUtilities.SetupPlotLegend(newPlot, "Days Per Book With Time Plot"); SetupDaysPerBookWithTimeVsTimeAxes(newPlot); // create series and add them to the plot LineSeries overallSeries; LineSeries overallTrendlineSeries; OxyPlotUtilities.CreateLineSeries( out overallSeries, ChartAxisKeys.DateKey, ChartAxisKeys.DaysKey, "Overall", 1); OxyPlotUtilities.CreateLineSeries( out overallTrendlineSeries, ChartAxisKeys.DateKey, ChartAxisKeys.DaysKey, "Overall Trendline", 0); ICurveFitter curveFitter; GetDaysPerBookWithTimeCurveFitter(out curveFitter); foreach (var delta in BooksReadProvider.BookDeltas) { double trendPageRate = curveFitter.EvaluateYValueAtPoint(delta.DaysSinceStart); overallSeries.Points.Add( new DataPoint(DateTimeAxis.ToDouble(delta.Date), delta.OverallTally.DaysPerBook)); overallTrendlineSeries.Points.Add( new DataPoint(DateTimeAxis.ToDouble(delta.Date), trendPageRate)); } OxyPlotUtilities.AddLineSeriesToModel(newPlot, new[] { overallSeries, overallTrendlineSeries }); // finally update the model with the new plot return(newPlot); }
/// <summary> /// Sets up the plot model to be displayed. /// </summary> /// <returns>The plot model.</returns> protected override PlotModel SetupPlot() { // Create the plot model var newPlot = new PlotModel { Title = "Books and Pages per Year Plot" }; OxyPlotUtilities.SetupPlotLegend(newPlot, "Books and Pages per Year Plot"); SetupBookAndPagesPerYearVsTimeAxes(newPlot); if (BooksReadProvider.BookPerYearDeltas.Count < 1) { return(newPlot); } // create series and add them to the plot LineSeries booksReadSeries; LineSeries booksReadTrendlineSeries; OxyPlotUtilities.CreateLineSeries(out booksReadSeries, ChartAxisKeys.DateKey, ChartAxisKeys.BooksReadKey, "Books Read", 1); OxyPlotUtilities.CreateLineSeries(out booksReadTrendlineSeries, ChartAxisKeys.DateKey, ChartAxisKeys.BooksReadKey, "Books Read Trendline", 4); ICurveFitter curveFitterBooks; GetBooksReadWithTimeCurveFitter(out curveFitterBooks); LineSeries pagesReadSeries; LineSeries pagesReadTrendlineSeries; OxyPlotUtilities.CreateLineSeries(out pagesReadSeries, ChartAxisKeys.DateKey, ChartAxisKeys.PagesPerDayKey, "Pages Read", 0); OxyPlotUtilities.CreateLineSeries(out pagesReadTrendlineSeries, ChartAxisKeys.DateKey, ChartAxisKeys.PagesPerDayKey, "Pages Read Trendline", 3); ICurveFitter curveFitterPages; GetPagesReadWithTimeCurveFitter(out curveFitterPages); DateTime start = BooksReadProvider.BookPerYearDeltas[0].Date; foreach (var delta in BooksReadProvider.BookPerYearDeltas) { int daysSinceStart = (delta.Date - start).Days; double trendBooks = curveFitterBooks.EvaluateYValueAtPoint(daysSinceStart); double trendPages = curveFitterPages.EvaluateYValueAtPoint(daysSinceStart); booksReadSeries.Points.Add( new DataPoint(DateTimeAxis.ToDouble(delta.Date), delta.OverallTally.TotalBooks)); booksReadTrendlineSeries.Points.Add( new DataPoint(DateTimeAxis.ToDouble(delta.Date), trendBooks)); pagesReadSeries.Points.Add( new DataPoint(DateTimeAxis.ToDouble(delta.Date), delta.OverallTally.PageRate)); pagesReadTrendlineSeries.Points.Add( new DataPoint(DateTimeAxis.ToDouble(delta.Date), trendPages)); } OxyPlotUtilities.AddLineSeriesToModel( newPlot, new[] { booksReadSeries, booksReadTrendlineSeries, pagesReadSeries, pagesReadTrendlineSeries }); // finally update the model with the new plot return(newPlot); }