Ejemplo n.º 1
0
        /// <summary>
        /// Renders the icon on the specified render context.
        /// </summary>
        /// <param name="rc">The render context.</param>
        /// <param name="size">The size.</param>
        public override void Render(IRenderContext rc, double size)
        {
            var n       = (int)size;
            var data    = ArrayHelper.Evaluate(Functions.Peaks, ArrayHelper.CreateVector(-3.1, 3.1, n), ArrayHelper.CreateVector(3, -3, n));
            var palette = OxyPalettes.Jet(256);
            var min     = data.Min2D();
            var max     = data.Max2D();
            var pixels  = new OxyColor[n, n];

            for (int x = 0; x < n; x++)
            {
                for (int y = 0; y < n; y++)
                {
                    var i = (int)((data[x, y] - min) / (max - min) * palette.Colors.Count);
                    i = Math.Min(Math.Max(i, 0), palette.Colors.Count - 1);
                    rc.DrawRectangle(new OxyRect(x, y, 1, 1), palette.Colors[i], OxyColors.Undefined, 0);
                }
            }

            var frameWidth = (int)Math.Max(Math.Round(size / 32), 1);

            rc.DrawRectangle(new OxyRect(0, 0, size, frameWidth), OxyColors.Black, OxyColors.Black, 0);
            rc.DrawRectangle(new OxyRect(0, size - frameWidth, size, frameWidth), OxyColors.Black, OxyColors.Undefined, 0);
            rc.DrawRectangle(new OxyRect(0, 0, frameWidth, size), OxyColors.Black, OxyColors.Undefined, 0);
            rc.DrawRectangle(new OxyRect(size - frameWidth, 0, frameWidth, size), OxyColors.Black, OxyColors.Undefined, 0);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Adds a peaks HeatMapSeries to the plot model.
        /// </summary>
        /// <param name="pm">The plot model.</param>
        public void AddPeaks(PlotModel pm)
        {
            double x0        = -3.1;
            double x1        = 3.1;
            double y0        = -3;
            double y1        = 3;
            var    xx        = ArrayHelper.CreateVector(x0, x1, 100);
            var    yy        = ArrayHelper.CreateVector(y0, y1, 100);
            var    peaksData = ArrayHelper.Evaluate(Functions.Peaks, xx, yy);

            pm.Axes.Add(
                new LinearColorAxis
            {
                Position      = AxisPosition.Right,
                Palette       = OxyPalettes.Jet(500),
                HighColor     = OxyColors.Gray,
                LowColor      = OxyColors.Black,
                IsAxisVisible = false
            });

            var hms = new HeatMapSeries {
                X0 = x0, X1 = x1, Y0 = y0, Y1 = y1, Data = peaksData
            };

            pm.Series.Add(hms);
        }
Ejemplo n.º 3
0
        private async Task Initialize()
        {
            var x0 = -3.5;
            var x1 = 2.4;
            var y0 = -4.0;
            var y1 = 4;
            var n  = 100;

            var puntosRastrigin = await MockDatabase.ObtenerPuntosRastrigin(x0, x1, y0, y1, n);

            var serie = new HeatMapSeries
            {
                X0    = x0,
                X1    = x1,
                Y0    = y0,
                Y1    = y1,
                Data  = puntosRastrigin,
                Title = "Rastrigin"
            };

            ChartModel.Series.Add(serie);
            ChartModel.Axes.Add(new LinearColorAxis {
                Position = AxisPosition.Right, Palette = OxyPalettes.Jet(500), HighColor = OxyColors.Gray, LowColor = OxyColors.Black
            });
        }
Ejemplo n.º 4
0
        public static PlotModel ColorCodingOnScatterPlots()
        {
            var model = new PlotModel {
                Title = "Colour coding on scatter plots"
            };
            var colorAxis = new LinearColorAxis {
                Position = AxisPosition.Right, Palette = OxyPalettes.Jet(500), Minimum = 0, Maximum = 5, HighColor = OxyColors.Gray, LowColor = OxyColors.Black
            };

            model.Axes.Add(colorAxis);

            var s4 = new ScatterSeries {
                MarkerType = MarkerType.Circle
            };

            s4.Points.Add(new ScatterPoint(3, 5, 5, 0));
            s4.Points.Add(new ScatterPoint(5, 5, 7, 0));
            s4.Points.Add(new ScatterPoint(2, 4, 5, 0.3));
            s4.Points.Add(new ScatterPoint(3, 3, 8, 0));
            s4.Points.Add(new ScatterPoint(3, 2, 5, 0));
            s4.Points.Add(new ScatterPoint(3, 5, 8, 1));
            s4.Points.Add(new ScatterPoint(2, 2, 3, 5));
            s4.Points.Add(new ScatterPoint(1, 4, 4, 1));
            s4.Points.Add(new ScatterPoint(4, 3, 5, 3));
            s4.Points.Add(new ScatterPoint(0, 0, 1, 1));
            s4.Points.Add(new ScatterPoint(8, 8, 1, 1));
            model.Series.Add(s4);
            return(model);
        }
Ejemplo n.º 5
0
        public MainWindow()
        {
            // generate some dummy items
            this.Items = new List <RectangleWithValue>();
            for (int i = 0; i < NumberOfItems; i++)
            {
                this.Items.Add(new RectangleWithValue(i));
            }

            this.PlotModel = new PlotModel();

            this.PlotModel.Axes.Add(new LinearColorAxis
            {
                Position = AxisPosition.Right,
                Palette  = OxyPalettes.Jet(100)
            });

            this.PlotModel.Series.Add(new RectangleSeries
            {
                ItemsSource = this.Items,
                Mapping     = obj =>
                {
                    var rectangleWithValue = (RectangleWithValue)obj;

                    return(new RectangleItem(
                               rectangleWithValue.X1,
                               rectangleWithValue.X2,
                               rectangleWithValue.Y1,
                               rectangleWithValue.Y2,
                               rectangleWithValue.Value));
                }
            });

            this.InitializeComponent();
        }
        public static PlotModel ScatterSeries()
        {
            var model = new PlotModel {
                Title = "ScatterSeries"
            };
            var scatterSeries = new ScatterSeries {
                MarkerType = MarkerType.Circle
            };
            var r = new Random(314);

            for (int i = 0; i < 100; i++)
            {
                var x          = r.NextDouble();
                var y          = r.NextDouble();
                var size       = r.Next(5, 15);
                var colorValue = r.Next(100, 1000);
                scatterSeries.Points.Add(new ScatterPoint(x, y, size, colorValue));
            }

            model.Series.Add(scatterSeries);
            model.Axes.Add(new LinearColorAxis {
                Position = AxisPosition.Right, Palette = OxyPalettes.Jet(200)
            });
            return(model);
        }
Ejemplo n.º 7
0
        public static PlotModel FromItems()
        {
            const int NumberOfItems = 10;
            var       model         = new PlotModel {
                Title = "RectangleSeries"
            };

            // the RectangleSeries requires a color axis
            model.Axes.Add(new LinearColorAxis
            {
                Position = AxisPosition.Right,
                Palette  = OxyPalettes.Jet(100)
            });

            // create the series and add some rectangles with values
            var s = new RectangleSeries()
            {
                LabelFontSize = 12
            };

            for (int i = NumberOfItems - 1; i >= 0; i--)
            {
                s.Items.Add(new RectangleItem(-i * 0.5, i * 0.5, i * i, i * (i + 3), i));
            }

            model.Series.Add(s);

            return(model);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Creates a simple example heat map from a 2×3 matrix.
        /// </summary>
        /// <param name="title">The title.</param>
        /// <param name="interpolate">Interpolate the HeatMapSeries if set to <c>true</c>.</param>
        /// <returns>A <see cref="PlotModel" />.</returns>
        private static PlotModel CreateExample(string title, bool interpolate)
        {
            var data = new double[2, 3];

            data[0, 0] = 0;
            data[0, 1] = 0.2;
            data[0, 2] = 0.4;
            data[1, 0] = 0.1;
            data[1, 1] = 0.3;
            data[1, 2] = 0.2;

            var model = new PlotModel {
                Title = "HeatMapSeries", Subtitle = title
            };

            model.Axes.Add(new LinearColorAxis {
                Position = AxisPosition.Right, Palette = OxyPalettes.Jet(500), HighColor = OxyColors.Gray, LowColor = OxyColors.Black
            });

            // adding half cellwidth/cellheight to bounding box coordinates
            var hms = new HeatMapSeries
            {
                CoordinateDefinition = HeatMapCoordinateDefinition.Center,
                X0            = 0.5,
                X1            = 1.5,
                Y0            = 0.5,
                Y1            = 2.5,
                Data          = data,
                Interpolate   = interpolate,
                LabelFontSize = 0.2
            };

            model.Series.Add(hms);
            return(model);
        }
Ejemplo n.º 9
0
        public static OxyColor[] GenerateOxyColors(this ColorPalettes palette, Int32 length)
        {
            var colors        = new OxyColor[length];
            var args          = new Object[] { length };
            var paletteString = palette.ToString();
            var method        = typeof(OxyPalettes).GetMethod(paletteString);
            var oxyPalette    = default(OxyPalette);

            if (method != null)
            {
                oxyPalette = method.Invoke(null, args) as OxyPalette;
            }

            if (oxyPalette == null)
            {
                oxyPalette = OxyPalettes.Jet(length);
            }

            for (var i = 0; i < length; i++)
            {
                colors[i] = oxyPalette.Colors[i];
            }

            return(colors);
        }
        public override void OnAppearing(object navigationContext)
        {
            base.OnAppearing(navigationContext);

            PlotModel = new PlotModel
            {
                Title = "HeatMap"
            };

            double x0 = -3.1;
            double x1 = 3.1;
            double y0 = -3;
            double y1 = 3;

            Func <double, double, double> peaks = (x, y) => 3 * (1 - x) * (1 - x) * Math.Exp(-(x * x) - (y + 1) * (y + 1)) - 10 * (x / 5 - x * x * x - y * y * y * y * y) * Math.Exp(-x * x - y * y) - 1.0 / 3 * Math.Exp(-(x + 1) * (x + 1) - y * y);
            var xx        = ArrayBuilder.CreateVector(x0, x1, 100);
            var yy        = ArrayBuilder.CreateVector(y0, y1, 100);
            var peaksData = ArrayBuilder.Evaluate(peaks, xx, yy);

            PlotModel.Axes.Add(new LinearColorAxis {
                Position = AxisPosition.Right, Palette = OxyPalettes.Jet(500), HighColor = OxyColors.Gray, LowColor = OxyColors.Black
            });

            var heatMapSerie = new HeatMapSeries {
                X0 = x0, X1 = x1, Y0 = y0, Y1 = y1, Data = peaksData
            };

            PlotModel.Series.Add(heatMapSerie);
        }
Ejemplo n.º 11
0
        public static PlotModel Diagonal_6X6()
        {
            var data = new double[6, 6];

            data[0, 0] = 1;
            data[1, 1] = 1;
            data[2, 2] = 1;
            data[3, 3] = 1;
            data[4, 4] = 1;
            data[5, 5] = 1;

            var model = new PlotModel {
                Title = "Diagonal 6×6"
            };

            model.Axes.Add(new LinearColorAxis {
                Position = AxisPosition.Right, Palette = OxyPalettes.Jet(500), HighColor = OxyColors.Gray, LowColor = OxyColors.Black
            });

            // note: the coordinates are specifying the centers of the edge cells
            var hms = new HeatMapSeries {
                X0 = 0, X1 = 5, Y0 = 5, Y1 = 0, Data = data, Interpolate = false
            };

            model.Series.Add(hms);
            return(model);
        }
Ejemplo n.º 12
0
        public override async Task OnInitializing()
        {
            var model = new Chart.PlotModel {
                Title = "ScatterSeries"
            };
            var scatterSeries = new Chart.Scatter();
            var r             = new Random(314);

            for (int i = 0; i < 100; i++)
            {
                var x          = r.NextDouble();
                var y          = r.NextDouble();
                var size       = r.Next(5, 15);
                var colorValue = r.Next(100, 1000);
                scatterSeries.Data.Add(new Chart.ScatterPoint(x, y, size, colorValue));
            }

            model.Series.Add(scatterSeries);
            model.Axes.Add(new LinearColorAxis {
                Position = AxisPosition.Right, Palette = OxyPalettes.Jet(200)
            });
            await base.OnInitializing();

            await scatterBarPlotView.Add(model);
        }
Ejemplo n.º 13
0
    public static PlotModel Mandelbrot()
    {
        // http://en.wikipedia.org/wiki/Mandelbrot_set
        var model = new PlotModel {
            Title = "The Mandelbrot set"
        };

        model.Axes.Add(new LinearAxis {
            Position = AxisPosition.Left, Minimum = -1.4, Maximum = 1.4
        });
        model.Axes.Add(new LinearAxis {
            Position = AxisPosition.Bottom, Minimum = -2, Maximum = 1
        });
        model.Axes.Add(
            new ColorAxis
        {
            Position  = AxisPosition.Right,
            Minimum   = 0,
            Maximum   = 64,
            Palette   = OxyPalettes.Jet(64),
            HighColor = OxyColors.Black
        });
        model.Series.Add(new MandelbrotSeries());

        return(model);
    }
        public static PlotModel HeatMapSeries()
        {
            var model = new PlotModel {
                Title = "HeatMapSeries"
            };
            double x0 = -3.1;
            double x1 = 3.1;
            double y0 = -3;
            double y1 = 3;
            Func <double, double, double> peaks = (x, y) => 3 * (1 - x) * (1 - x) * Math.Exp(-(x * x) - (y + 1) * (y + 1)) - 10 * (x / 5 - x * x * x - y * y * y * y * y) * Math.Exp(-x * x - y * y) - 1.0 / 3 * Math.Exp(-(x + 1) * (x + 1) - y * y);
            var xx        = ArrayBuilder.CreateVector(x0, x1, 100);
            var yy        = ArrayBuilder.CreateVector(y0, y1, 100);
            var peaksData = ArrayBuilder.Evaluate(peaks, xx, yy);

            model.Axes.Add(new LinearColorAxis {
                Position = AxisPosition.Right, Palette = OxyPalettes.Jet(500), HighColor = OxyColors.Gray, LowColor = OxyColors.Black
            });

            var hms = new HeatMapSeries {
                X0 = x0, X1 = x1, Y0 = y0, Y1 = y1, Data = peaksData
            };

            model.Series.Add(hms);

            return(model);
        }
Ejemplo n.º 15
0
        public PlotModel GetNewModel(string title = "", string xname = "", string yname = "")
        {
            var m = new PlotModel {
                Title = title
            };
            var linearAxis1 = new LinearAxis();

            linearAxis1.MajorGridlineStyle = LineStyle.Solid;
            linearAxis1.MaximumPadding     = 0;
            linearAxis1.MinimumPadding     = 0;
            linearAxis1.MinorGridlineStyle = LineStyle.Dot;
            linearAxis1.Position           = AxisPosition.Bottom;
            linearAxis1.Title = xname;
            m.Axes.Add(linearAxis1);
            var linearAxis2 = new LinearAxis();

            linearAxis2.MajorGridlineStyle = LineStyle.Solid;
            linearAxis2.MaximumPadding     = 0;
            linearAxis2.MinimumPadding     = 0;
            linearAxis2.MinorGridlineStyle = LineStyle.Dot;
            linearAxis2.Title = yname;
            m.Axes.Add(linearAxis2);

            colorAxis = new LinearColorAxis {
                Position = AxisPosition.Right,
                Palette  = OxyPalettes.Jet(200),
                Minimum  = 0,
                Maximum  = 1
            };
            m.Axes.Add(colorAxis);

            return(m);
        }
Ejemplo n.º 16
0
        public static PlotModel Position_None()
        {
            var model     = HeatMapSeriesExamples.CreatePeaks(OxyPalettes.Jet(600), false);
            var colorAxis = (LinearColorAxis)model.Axes[0];

            colorAxis.Position = AxisPosition.None;
            return(model);
        }
Ejemplo n.º 17
0
        public static PlotModel Horizontal_6()
        {
            var model     = HeatMapSeriesExamples.CreatePeaks(OxyPalettes.Jet(6), false);
            var colorAxis = (LinearColorAxis)model.Axes[0];

            colorAxis.Position = AxisPosition.Top;
            return(model);
        }
Ejemplo n.º 18
0
        public static PlotModel RenderAsImage_Vertical()
        {
            var model     = HeatMapSeriesExamples.CreatePeaks(OxyPalettes.Jet(1000), false);
            var colorAxis = (LinearColorAxis)model.Axes[0];

            colorAxis.RenderAsImage = true;
            return(model);
        }
Ejemplo n.º 19
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);
        }
Ejemplo n.º 20
0
        public static PlotModel Vertical_Short()
        {
            var model     = HeatMapSeriesExamples.CreatePeaks(OxyPalettes.Jet(600), false);
            var colorAxis = (LinearColorAxis)model.Axes[0];

            colorAxis.StartPosition = 0.02;
            colorAxis.EndPosition   = 0.5;
            return(model);
        }
Ejemplo n.º 21
0
    public MainWindow() : base(Gtk.WindowType.Toplevel)
    {
        Build();

        var plotView = new PlotView();

        this.Add(plotView);
        plotView.ShowAll();

        // Choose file
        Gtk.FileChooserDialog fcd = new Gtk.FileChooserDialog("Open File", null, Gtk.FileChooserAction.Open);
        fcd.AddButton(Gtk.Stock.Cancel, Gtk.ResponseType.Cancel);
        fcd.AddButton(Gtk.Stock.Open, Gtk.ResponseType.Ok);
        fcd.DefaultResponse = Gtk.ResponseType.Ok;
        fcd.SelectMultiple  = false;
        Gtk.ResponseType response = (Gtk.ResponseType)fcd.Run();

        String DataFile = fcd.Filename;

        if (response == ResponseType.Ok)
        {
            // Run scan Matching
            ScanMatching.RunScanMatch(DataFile);
            Console.WriteLine($"{DataFile} selected");
        }
        else
        {
            Console.WriteLine("no file selected");
        }

        fcd.Destroy();

        // Run Plot
        var model = new PlotModel {
            Title = "Scan Matching"
        };
        var scatterSeries = new ScatterSeries {
            MarkerType = MarkerType.Circle
        };
        var r = new Random(314);

        for (int i = 0; i < D_Scan_Matching_GUI.ScanMatching.rPNn.ColumnCount; i++)
        {
            var x          = D_Scan_Matching_GUI.ScanMatching.rPNn[0, i];
            var y          = D_Scan_Matching_GUI.ScanMatching.rPNn[1, i];
            var size       = 5;
            var colorValue = 1500;
            scatterSeries.Points.Add(new ScatterPoint(x, y, size, colorValue));
        }

        model.Series.Add(scatterSeries);
        model.Axes.Add(new LinearColorAxis {
            Position = AxisPosition.Right, Palette = OxyPalettes.Jet(200)
        });
        plotView.Model = model;
    }
Ejemplo n.º 22
0
        public static PlotModel RenderAsImage_Horizontal_Reversed()
        {
            var model     = HeatMapSeriesExamples.CreatePeaks(OxyPalettes.Jet(1000), false);
            var colorAxis = (LinearColorAxis)model.Axes[0];

            colorAxis.RenderAsImage = true;
            colorAxis.Position      = AxisPosition.Top;
            colorAxis.StartPosition = 1;
            colorAxis.EndPosition   = 0;
            return(model);
        }
Ejemplo n.º 23
0
        void ConfigureChartForLogic(object ChartControl)
        {
            var myModel = new PlotModel();

            myModel.Axes.Add(new LinearAxis()  //X
            {
                Position           = AxisPosition.Bottom,
                Title              = "uS",
                IsZoomEnabled      = true,
                IsPanEnabled       = true,
                MinimumMinorStep   = 1,
                MinimumMajorStep   = 10,
                LabelFormatter     = formatter,
                MinimumRange       = 10,
                TicklineColor      = OxyColors.White,
                AxislineColor      = OxyColors.White,
                TitleColor         = OxyColors.White,
                MinorTicklineColor = OxyColors.LightGray
            });
            myModel.Axes.Add(new LinearAxis()       //Y
            {
                Position           = AxisPosition.Left,
                Title              = "Level",
                IsZoomEnabled      = false,
                IsPanEnabled       = false,
                MinimumMinorStep   = 1,
                MinimumMajorStep   = 1,
                AbsoluteMaximum    = 1.35,
                AbsoluteMinimum    = -0.75,
                Minimum            = -0.75,
                Maximum            = 1.35,
                TicklineColor      = OxyColors.White,
                AxislineColor      = OxyColors.White,
                TitleColor         = OxyColors.White,
                MinorTicklineColor = OxyColors.LightGray
            });
            myModel.Axes.Add(new LinearColorAxis
            {
                Position        = AxisPosition.None,
                Palette         = OxyPalettes.Jet(4),
                AbsoluteMaximum = 3,
                AbsoluteMinimum = -3,
                Maximum         = 3,
                Minimum         = -3
            });
            myModel.Background               = OxyColors.Black;
            myModel.TextColor                = OxyColors.White;
            myModel.TitleColor               = OxyColors.White;
            myModel.PlotAreaBorderColor      = OxyColors.LightGray;
            myModel.SelectionColor           = OxyColors.LightBlue;
            myModel.DefaultFont              = StandardFonts.Helvetica.BoldFont.BaseFont;
            (ChartControl as PlotView).Model = myModel;
        }
Ejemplo n.º 24
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);
        }
        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"
            });
        }
Ejemplo n.º 26
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);
        }
Ejemplo n.º 27
0
        private static PlotModel Surf2DModel(Surface2D surf)
        {
            var plotModel1 = new PlotModel
            {
                PlotType         = PlotType.Cartesian,
                Title            = surf.Title,
                Subtitle         = surf.Subtitle,
                SubtitleFontSize = 10,
                TitleFont        = "Tahoma",
                TitleFontSize    = 12,
                DefaultFont      = "Tahoma",
                IsLegendVisible  = false
            };

            var linearColorAxis1 = new LinearColorAxis
            {
                Title              = surf.ZAxisTitle,
                Unit               = surf.ZUnit,
                Position           = AxisPosition.Right,
                AxisDistance       = 5.0,
                InvalidNumberColor = OxyColors.Transparent,
                Palette            = OxyPalettes.Jet(256)
            };

            plotModel1.Axes.Add(linearColorAxis1);

            var linearAxis1 = new LinearAxis
            {
                MajorGridlineColor = OxyColor.FromArgb(40, 0, 0, 139),
                MajorGridlineStyle = LineStyle.Solid,
                MinorGridlineColor = OxyColor.FromArgb(20, 0, 0, 139),
                MinorGridlineStyle = LineStyle.Solid,
                Position           = AxisPosition.Bottom,
                Title = surf.XAxisTitle,
                Unit  = surf.XUnit
            };

            plotModel1.Axes.Add(linearAxis1);
            var linearAxis2 = new LinearAxis
            {
                MajorGridlineColor = OxyColor.FromArgb(40, 0, 0, 139),
                MajorGridlineStyle = LineStyle.Solid,
                MinorGridlineColor = OxyColor.FromArgb(20, 0, 0, 139),
                MinorGridlineStyle = LineStyle.Solid,
                Title = surf.YAxisTitle,
                Unit  = surf.YUnit
            };

            plotModel1.Axes.Add(linearAxis2);

            return(plotModel1);
        }
Ejemplo n.º 28
0
        /// <summary>
        /// Initializes a new instance of the <see cref="LinearColorAxis" /> class.
        /// </summary>
        public LinearColorAxis()
        {
            this.Position     = AxisPosition.None;
            this.AxisDistance = 20;

            this.IsPanEnabled  = false;
            this.IsZoomEnabled = false;
            this.Palette       = OxyPalettes.Jet(200);

            this.LowColor           = OxyColors.Undefined;
            this.HighColor          = OxyColors.Undefined;
            this.InvalidNumberColor = OxyColors.Gray;
        }
Ejemplo n.º 29
0
 /// <summary>
 /// Create the palette list.
 /// </summary>
 private void CreatePaletteList()
 {
     PaletteList = new BindingList <OxyPalette>();
     PaletteList.Add(OxyPalettes.BlackWhiteRed(64));
     PaletteList.Add(OxyPalettes.BlueWhiteRed(64));
     PaletteList.Add(OxyPalettes.BlueWhiteRed31);
     PaletteList.Add(OxyPalettes.Cool(64));
     PaletteList.Add(OxyPalettes.Gray(64));
     PaletteList.Add(OxyPalettes.Hot(64));
     PaletteList.Add(OxyPalettes.Hue64);
     PaletteList.Add(OxyPalettes.HueDistinct(64));
     PaletteList.Add(OxyPalettes.Jet(64));
     PaletteList.Add(OxyPalettes.Rainbow(64));
 }
Ejemplo n.º 30
0
        public static PlotModel TwoScatterSeries()
        {
            var model = new PlotModel {
                Title = "Two ScatterSeries (with and without values)", Subtitle = "With values (squares), without values (triangles)"
            };
            var colorAxis = new LinearColorAxis {
                Position = AxisPosition.Right, Key = "ColorAxis", Palette = OxyPalettes.Jet(30), Minimum = -1, Maximum = 1
            };

            model.Axes.Add(colorAxis);
            model.Series.Add(CreateRandomScatterSeries(50, MarkerType.Triangle, false, false, null));
            model.Series.Add(CreateRandomScatterSeries(50, MarkerType.Square, false, true, colorAxis));
            return(model);
        }