コード例 #1
0
        public static PlotModel RandomScatter(int n, int binsize)
        {
            var model = new PlotModel(string.Format("ScatterSeries (n={0})", n), "BinSize = " + binsize);

            var s1 = new ScatterSeries("Series 1")
            {
                MarkerType = MarkerType.Diamond,
                MarkerStrokeThickness = 0,
                BinSize = binsize
            };
            var random = new Random();
            for (int i = 0; i < n; i++)
            {
                s1.Points.Add(new ScatterPoint(random.NextDouble(), random.NextDouble()));
            }

            model.Series.Add(s1);
            return model;
        }
コード例 #2
0
        public static PlotModel CreateRandomScatterSeriesWithColorAxisPlotModel(int n, OxyPalette palette, MarkerType markerType = MarkerType.Square, AxisPosition colorAxisPosition = AxisPosition.Right, OxyColor highColor = null, OxyColor lowColor = null)
        {
            var model = new PlotModel(string.Format("ScatterSeries (n={0})", n)) { Background = OxyColors.LightGray };
            model.Axes.Add(new ColorAxis { Position = colorAxisPosition, Palette = palette, Minimum = -1, Maximum = 1, HighColor = highColor, LowColor = lowColor });

            var s1 = new ScatterSeries
            {
                MarkerType = markerType,
                MarkerSize = 6,
            };
            var random = new Random();
            for (int i = 0; i < n; i++)
            {
                double x = random.NextDouble() * 2.2 - 1.1;
                s1.Points.Add(new ScatterPoint(x, random.NextDouble()) { Value = x });
            }

            model.Series.Add(s1);
            return model;
        }
コード例 #3
0
 public static PlotModel ScatterSeries5()
 {
     var model = new PlotModel("ScatterSeries (cross)");
     var s1 = new ScatterSeries();
     s1.MarkerType = MarkerType.Cross;
     s1.MarkerFill = null;
     s1.MarkerStroke = OxyColors.Black;
     AddPoints(s1.Points, 2000);
     model.Series.Add(s1);
     return model;
 }
コード例 #4
0
 public static PlotModel ScatterSeries4()
 {
     var model = new PlotModel("ScatterSeries (circles with outline)");
     var s1 = new ScatterSeries();
     s1.MarkerType = MarkerType.Circle;
     s1.MarkerStroke = OxyColors.Black;
     AddPoints(s1.Points, 2000);
     model.Series.Add(s1);
     return model;
 }
コード例 #5
0
 public static PlotModel ScatterSeries3()
 {
     var model = new PlotModel("ScatterSeries (circles)");
     var s1 = new ScatterSeries();
     s1.MarkerType = MarkerType.Circle;
     AddPoints(s1.Points, 2000);
     model.Series.Add(s1);
     return model;
 }
コード例 #6
0
 public static PlotModel ScatterSeries1c()
 {
     var model = new PlotModel("ScatterSeries (squares without fill color)");
     var s1 = new ScatterSeries();
     s1.MarkerFill = OxyColors.Transparent;
     s1.MarkerStroke = OxyColors.Black;
     AddPoints(s1.Points, 2000);
     model.Series.Add(s1);
     return model;
 }
コード例 #7
0
 public static PlotModel ScatterSeries1()
 {
     var model = new PlotModel("ScatterSeries (squares)");
     var s1 = new ScatterSeries();
     AddPoints(s1.Points, 2000);
     model.Series.Add(s1);
     return model;
 }
コード例 #8
0
 private static ScatterSeries CreateRandomScatterSeries(int n, string title, MarkerType markerType)
 {
     var s1 = new ScatterSeries { Title = title, MarkerType = markerType, MarkerStroke = OxyColors.Black, MarkerStrokeThickness = 1.0 };
     for (int i = 0; i < n; i++)
     {
         double x = Randomizer.NextDouble() * 10;
         double y = Randomizer.NextDouble() * 10;
         var p = new ScatterPoint(x, y);
         s1.Points.Add(p);
     }
     return s1;
 }
コード例 #9
0
        public static PlotModel RandomWithFit()
        {
            const int n = 20;
            var model = new PlotModel(string.Format("Random data (n={0})", n)) { LegendPosition = LegendPosition.LeftTop };

            var s1 = new ScatterSeries { Title = "Measurements" };
            var random = new Random();
            double x = 0;
            double y = 0;
            for (int i = 0; i < n; i++)
            {
                x += 2 + random.NextDouble() * 10;
                y += 1 + random.NextDouble();
                var p = new ScatterPoint(x, y);
                s1.Points.Add(p);
            }
            model.Series.Add(s1);
            double a, b;
            LeastSquaresFit(s1.Points, out a, out b);
            model.Annotations.Add(new LineAnnotation { Slope = a, Intercept = b, Text = "Least squares fit" });
            return model;
        }