コード例 #1
0
        private PlotModel SetupCountryLocationsBooksReadPlot()
        {
            // Create the plot model
            var newPlot = new PlotModel {
                Title = "Countries in Location with Books Read Plot"
            };

            OxyPlotUtilities.SetupPlotLegend(newPlot, "Countries in Location with Books Read Plot");
            SetupLatitudeAndLongitudeAxes(newPlot);

            // create series and add them to the plot
            ScatterSeries pointsSeries;

            OxyPlotUtilities.CreateScatterPointSeries(out pointsSeries,
                                                      ChartAxisKeys.LongitudeKey, ChartAxisKeys.LatitudeKey, "Countries");

            foreach (var authorCountry in _mainModel.AuthorCountries)
            {
                var name    = authorCountry.Country;
                var country = _mainModel.WorldCountries.Where(w => w.Country == name).FirstOrDefault();
                if (country != null)
                {
                    var pointSize = authorCountry.TotalBooksReadFromCountry;
                    if (pointSize < 5)
                    {
                        pointSize = 5;
                    }

                    ScatterPoint point =
                        new ScatterPoint(country.Longitude, country.Latitude, pointSize,
                                         authorCountry.TotalBooksReadFromCountry)
                    {
                        Tag = name
                    };
                    pointsSeries.Points.Add(point);
                }
            }

            pointsSeries.TrackerFormatString = "{Tag}\nLat/Long ( {4:0.###} ,{2:0.###} ) \nTotal Books {6}";
            newPlot.Series.Add(pointsSeries);

            List <OxyColor> colors = new List <OxyColor>();

            foreach (var color in OxyPalettes.Jet(200).Colors)
            {
                var faintColor = OxyColor.FromArgb(128, color.R, color.G, color.B);
                colors.Add(faintColor);
            }

            OxyPalette faintPalette = new OxyPalette(colors);

            newPlot.Axes.Add(new LinearColorAxis
            {
                Position = AxisPosition.Right, Palette = faintPalette, Title = "Books Read"
            });

            return(newPlot);
        }
        private void AddBooksAndPagesScatterSeries(PlotModel newPlot)
        {
            ScatterSeries pointsSeries;

            OxyPlotUtilities.CreateScatterPointSeries(out pointsSeries,
                                                      ChartAxisKeys.LongitudeKey, ChartAxisKeys.LatitudeKey, "Countries");

            foreach (AuthorCountry authorCountry in BooksReadProvider.AuthorCountries)
            {
                string       name    = authorCountry.Country;
                WorldCountry country = GeographyProvider.WorldCountries.FirstOrDefault(w => w.Country == name);
                if (country != null)
                {
                    int pointSize = authorCountry.TotalBooksReadFromCountry;
                    if (pointSize < 5)
                    {
                        pointSize = 5;
                    }

                    PolygonPoint latLong = new PolygonPoint()
                    {
                        Latitude = country.Latitude, Longitude = country.Longitude
                    };
                    double x, y;
                    latLong.GetCoordinates(out x, out y);

                    ScatterPoint point =
                        new ScatterPoint(x, y, pointSize,
                                         authorCountry.TotalPagesReadFromCountry)
                    {
                        Tag = name
                    };
                    pointsSeries.Points.Add(point);
                }
            }
            pointsSeries.RenderInLegend      = false;
            pointsSeries.TrackerFormatString = "{Tag}\nLat/Long ( {4:0.###} ,{2:0.###} ) \nTotalPages {6}";
            newPlot.Series.Add(pointsSeries);

            List <OxyColor> colors = new List <OxyColor>();

            foreach (OxyColor color in OxyPalettes.Jet(200).Colors)
            {
                OxyColor faintColor = OxyColor.FromArgb(128, color.R, color.G, color.B);
                colors.Add(faintColor);
            }

            OxyPalette faintPalette = new OxyPalette(colors);

            newPlot.Axes.Add(new LinearColorAxis {
                Position = AxisPosition.Right, Palette = faintPalette, Title = "Total Pages"
            });
        }
コード例 #3
0
        /// <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 = "Countries in Location with Books Read Plot"
            };

            OxyPlotUtilities.SetupPlotLegend(newPlot, "Countries in Location with Books Read Plot");
            SetupLatitudeAndLongitudeAxes(newPlot);

            // create series and add them to the plot
            ScatterSeries pointsSeries;

            OxyPlotUtilities.CreateScatterPointSeries(out pointsSeries,
                                                      ChartAxisKeys.LongitudeKey, ChartAxisKeys.LatitudeKey, "Countries");

            foreach (AuthorCountry authorCountry in BooksReadProvider.AuthorCountries)
            {
                string       name    = authorCountry.Country;
                WorldCountry country = GeographyProvider.WorldCountries.FirstOrDefault(w => w.Country == name);
                if (country != null)
                {
                    var pointSize = authorCountry.TotalBooksReadFromCountry;
                    if (pointSize < 5)
                    {
                        pointSize = 5;
                    }

                    ScatterPoint point =
                        new ScatterPoint(country.Longitude, country.Latitude, pointSize,
                                         authorCountry.TotalBooksReadFromCountry)
                    {
                        Tag = name
                    };
                    pointsSeries.Points.Add(point);
                }
            }

            pointsSeries.TrackerFormatString = "{Tag}\nLat/Long ( {4:0.###} ,{2:0.###} ) \nTotal Books {6}";
            newPlot.Series.Add(pointsSeries);

            List <OxyColor> colors =
                OxyPalettes.Jet(200).Colors.Select(color => OxyColor.FromArgb(128, color.R, color.G, color.B)).ToList();

            OxyPalette faintPalette = new OxyPalette(colors);

            newPlot.Axes.Add(new LinearColorAxis
            {
                Position = AxisPosition.Right, Palette = faintPalette, Title = "Books Read"
            });

            return(newPlot);
        }
コード例 #4
0
        private PlotModel SetupBooksAndPagesLastTenPlot()
        {
            // Create the plot model
            var newPlot = new PlotModel {
                Title = "Last 10 Books Time vs Pages Plot"
            };

            OxyPlotUtilities.SetupPlotLegend(newPlot, "Last 10 Books Time vs Pages Plot");
            SetupPagesPerDayWithTimeVsTimeAxes(newPlot);

            // create series and add them to the plot
            ScatterSeries pointsSeries;

            OxyPlotUtilities.CreateScatterPointSeries(out pointsSeries,
                                                      ChartAxisKeys.DaysTakenKey, ChartAxisKeys.TotalPagesReadKey, "Time Taken Vs Pages");

            List <BooksDelta> deltasSet = new List <BooksDelta>();

            foreach (var delta in _mainModel.BookDeltas)
            {
                deltasSet.Add(delta);
                if (deltasSet.Count < 10)
                {
                    continue;
                }

                BooksDelta end = deltasSet.Last();

                double daysTaken = end.LastTenTally.DaysInTally;
                double pagesRead = end.LastTenTally.TotalPages;

                double translated = end.LastTenTally.PercentageInTranslation;

                ScatterPoint point =
                    new ScatterPoint(daysTaken, pagesRead, 5, translated)
                {
                    Tag = end.Date.ToString("ddd d MMM yyy")
                };
                pointsSeries.Points.Add(point);

                deltasSet.RemoveAt(0);
            }
            pointsSeries.TrackerFormatString = "{Tag}\n{1}: {2:0.###}\n{3}: {4:0.###}\nTranslated % {6}";
            newPlot.Series.Add(pointsSeries);
            newPlot.Axes.Add(new LinearColorAxis
            {
                Position = AxisPosition.Right, Palette = OxyPalettes.Jet(200), Title = "Percentage Translated"
            });

            // finally update the model with the new plot
            return(newPlot);
        }
コード例 #5
0
        private void AddBooksAndPagesScatterSeries(PlotModel newPlot)
        {
            ScatterSeries pointsSeries;

            OxyPlotUtilities.CreateScatterPointSeries(out pointsSeries,
                                                      ChartAxisKeys.LongitudeKey, ChartAxisKeys.LatitudeKey, "Countries");

            foreach (var authorCountry in _mainModel.AuthorCountries)
            {
                var name    = authorCountry.Country;
                var country = _mainModel.WorldCountries.Where(w => w.Country == name).FirstOrDefault();
                if (country != null)
                {
                    var pointSize = authorCountry.TotalBooksReadFromCountry;
                    if (pointSize < 5)
                    {
                        pointSize = 5;
                    }

                    ScatterPoint point =
                        new ScatterPoint(country.Longitude, country.Latitude, pointSize,
                                         authorCountry.TotalPagesReadFromCountry)
                    {
                        Tag = name
                    };
                    pointsSeries.Points.Add(point);
                }
            }

            pointsSeries.TrackerFormatString = "{Tag}\nLat/Long ( {4:0.###} ,{2:0.###} ) \nTotalPages {6}";
            newPlot.Series.Add(pointsSeries);

            List <OxyColor> colors = new List <OxyColor>();

            foreach (var color in OxyPalettes.Jet(200).Colors)
            {
                var faintColor = OxyColor.FromArgb(128, color.R, color.G, color.B);
                colors.Add(faintColor);
            }

            OxyPalette faintPalette = new OxyPalette(colors);

            newPlot.Axes.Add(new LinearColorAxis {
                Position = AxisPosition.Right, Palette = faintPalette, Title = "Total Pages"
            });
        }
        private void AddLastTenLatLongWithTimeScatterSeries(PlotModel newPlot)
        {
            ScatterSeries pointsSeries;

            OxyPlotUtilities.CreateScatterPointSeries(out pointsSeries,
                                                      ChartAxisKeys.LongitudeKey, ChartAxisKeys.LatitudeKey, "Last Ten Books With Time");


            LineSeries overallSeries;

            OxyPlotUtilities.CreateLineSeries(out overallSeries, ChartAxisKeys.LongitudeKey, ChartAxisKeys.LatitudeKey, "Overall", 0);
            var faintColorBlue = OxyColor.FromArgb(80, OxyColors.Blue.R, OxyColors.Blue.G, OxyColors.Blue.B);

            overallSeries.Color           = faintColorBlue;
            overallSeries.StrokeThickness = 2;

            LineSeries lastTenSeries;

            OxyPlotUtilities.CreateLineSeries(out lastTenSeries, ChartAxisKeys.LongitudeKey, ChartAxisKeys.LatitudeKey, "Last 10", 0);
            var faintColorRed = OxyColor.FromArgb(80, OxyColors.Red.R, OxyColors.Red.G, OxyColors.Red.B);

            lastTenSeries.Color           = faintColorRed;
            lastTenSeries.StrokeThickness = 2;

            foreach (var delta in _mainModel.BookLocationDeltas)
            {
                var pointSize = 5;

                PolygonPoint latLong =
                    new PolygonPoint()
                {
                    Latitude = delta.AverageLatitudeLastTen, Longitude = delta.AverageLongitudeLastTen
                };
                double x, y;
                latLong.GetCoordinates(out x, out y);

                lastTenSeries.Points.Add(new DataPoint(x, y));

                ScatterPoint point =
                    new ScatterPoint(x, y, pointSize, delta.DaysSinceStart)
                {
                    Tag = delta.Date.ToString("ddd d MMM yyy")
                };
                pointsSeries.Points.Add(point);

                latLong =
                    new PolygonPoint()
                {
                    Latitude = delta.AverageLatitude, Longitude = delta.AverageLongitude
                };
                latLong.GetCoordinates(out x, out y);

                overallSeries.Points.Add(new DataPoint(x, y));
            }

            // don't draw these as renders the pic unusable
            //newPlot.Series.Add(lastTenSeries);
            //newPlot.Series.Add(overallSeries);

            pointsSeries.RenderInLegend      = false;
            pointsSeries.TrackerFormatString = "{Tag}\nLat/Long ( {4:0.###} ,{2:0.###} )";
            newPlot.Series.Add(pointsSeries);

            List <OxyColor> colors = new List <OxyColor>();

            foreach (var color in OxyPalettes.Jet(200).Colors)
            {
                var faintColor = OxyColor.FromArgb(80, color.R, color.G, color.B);
                colors.Add(faintColor);
            }

            OxyPalette faintPalette = new OxyPalette(colors);

            newPlot.Axes.Add(new LinearColorAxis {
                Position = AxisPosition.Right, Palette = faintPalette, Title = "Days Since Start"
            });
        }
コード例 #7
0
        /// <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 = "Last 10 Books Time vs Pages Plot"
            };

            OxyPlotUtilities.SetupPlotLegend(newPlot, "Last 10 Books Time vs Pages Plot");
            SetupPagesPerDayWithTimeVsTimeAxes(newPlot);

            // create series and add them to the plot
            ScatterSeries pointsSeries;

            OxyPlotUtilities.CreateScatterPointSeries(
                out pointsSeries,
                ChartAxisKeys.DaysTakenKey,
                ChartAxisKeys.TotalPagesReadKey,
                "Time Taken Vs Pages");

            List <BooksDelta> deltasSet = new List <BooksDelta>();

            double minRate = 1e16;
            double maxRate = 0.0;

            foreach (var delta in BooksReadProvider.BookDeltas)
            {
                deltasSet.Add(delta);
                if (deltasSet.Count < 10)
                {
                    continue;
                }

                BooksDelta end = deltasSet.Last();

                double daysTaken = end.LastTenTally.DaysInTally;
                double pagesRead = end.LastTenTally.TotalPages;
                if (daysTaken < 1.0)
                {
                    daysTaken = 1.0;
                }
                double       rate  = pagesRead / daysTaken;
                ScatterPoint point =
                    new ScatterPoint(daysTaken, pagesRead, 5, rate)
                {
                    Tag = end.Date.ToString("ddd d MMM yyy")
                };
                pointsSeries.Points.Add(point);

                if (minRate > rate)
                {
                    minRate = rate;
                }
                if (maxRate < rate)
                {
                    maxRate = rate;
                }

                deltasSet.RemoveAt(0);
            }
            pointsSeries.TrackerFormatString = "{Tag}\n{1}: {2:0.###}\n{3}: {4:0.###}";
            newPlot.Series.Add(pointsSeries);
            newPlot.Axes.Add(new LinearColorAxis {
                Position = AxisPosition.Right, Palette = OxyPalettes.Jet(200), Title = "Page Rate"
            });

            // finally update the model with the new plot
            return(newPlot);
        }