Esempio n. 1
0
        /// <summary>
        /// This method obtains up to 360 points of the selected satellite trajectory
        /// </summary>
        /// <param name="orbitModel"></param>
        private void GetOrbitPainted(PlotModel orbitModel)
        {
            double a   = tle_dataset._TLE_Sat_Selected.Sat_SemiAxis;
            double ecc = tle_dataset._TLE_Sat_Selected.Sat_Eccentricity;

            double r_pos = (a * (1 - Math.Pow(ecc, 2)));

            OxyPlot.Series.ScatterSeries orbit = new OxyPlot.Series.ScatterSeries();
            orbit.MarkerSize            = 1;
            orbit.MarkerStroke          = OxyColor.FromRgb(255, 0, 0);
            orbit.MarkerStrokeThickness = 1;

            orbitModel.Axes.Add(new LinearAxis {
                Position = AxisPosition.Bottom, MaximumPadding = 0.1, MinimumPadding = 0.1, AxislineColor = OxyColor.FromRgb(255, 255, 255), AxislineStyle = LineStyle.Solid, MajorGridlineColor = OxyColors.White
            });
            orbitModel.Axes.Add(new LinearAxis {
                Position = AxisPosition.Left, MaximumPadding = 0.1, MinimumPadding = 0.1, AxislineColor = OxyColor.FromRgb(255, 255, 255), AxislineStyle = LineStyle.Solid
            });

            for (int j = 0; j < 360; j++)
            {
                double rad    = (double)j * (double)2 * Math.PI / (double)360;
                double r_true = r_pos / (1 + ecc * Math.Cos(j));

                double x = r_true * Math.Cos(j);
                double y = r_true * Math.Sin(j);
                OxyPlot.Series.ScatterPoint point = new OxyPlot.Series.ScatterPoint(x, y);
                orbit.Points.Add(point);
            }

            orbitModel.Series.Add(orbit);
        }
Esempio n. 2
0
            public void ScatterSeries()
            {
                var s1 = new OxyPlot.Series.ScatterSeries();
                var s2 = new ScatterSeries();

                OxyAssert.PropertiesAreEqual(s1, s2);
            }
Esempio n. 3
0
        public void GetOrbit()
        {
            double a   = _tle_dataset._TLE_Sat_Selected.Sat_SemiAxis;
            double ecc = _tle_dataset._TLE_Sat_Selected.Sat_Eccentricity;
            double b   = a * Math.Pow(1 - Math.Pow(ecc, 2), 0.5);
            // Get focus distance to center (negative)
            double c = -Math.Sqrt(Math.Pow(a, 2) - Math.Pow(b, 2));

            double r_pos = (a * (1 - Math.Pow(ecc, 2)));

            OxyPlot.Series.ScatterSeries orbit = new OxyPlot.Series.ScatterSeries();
            orbit.MarkerSize            = 1;
            orbit.MarkerStroke          = OxyColor.FromRgb(255, 0, 0);
            orbit.MarkerStrokeThickness = 1;

            orbitModel.Axes.Add(new LinearAxis {
                Position = AxisPosition.Bottom, MaximumPadding = 0.1, MinimumPadding = 0.1
            });
            orbitModel.Axes.Add(new LinearAxis {
                Position = AxisPosition.Left, MaximumPadding = 0.1, MinimumPadding = 0.1
            });

            for (int j = 0; j < 360; j++)
            {
                double rad    = (double)j * (double)2 * Math.PI / (double)360;
                double r_true = r_pos / (1 + ecc * Math.Cos(j));

                double x = r_true * Math.Cos(j);
                double y = r_true * Math.Sin(j);
                OxyPlot.Series.ScatterPoint point = new OxyPlot.Series.ScatterPoint(x, y);
                orbit.Points.Add(point);
            }

            orbitModel.Series.Add(orbit);
        }
        private void CreateMdsChartModel()
        {
            var model = new PlotModel();

            var xAxis = new OxyPlot.Axes.LinearAxis
            {
                Position           = OxyPlot.Axes.AxisPosition.Bottom,
                MajorGridlineStyle = LineStyle.None
            };

            model.Axes.Add(xAxis);

            var yAxis = new OxyPlot.Axes.LinearAxis
            {
                Position           = OxyPlot.Axes.AxisPosition.Left,
                MajorGridlineStyle = LineStyle.None
            };

            model.Axes.Add(yAxis);

            var series = new OxyPlot.Series.ScatterSeries
            {
                ItemsSource = (Data.MdsCoords.Rows.Cast <filterReportDS.MdsCoordsRow>()
                               .Select(dr => new DataPoint(dr.X, dr.Y))),
                DataFieldX = "X",
                DataFieldY = "Y",
                MarkerType = MarkerType.Circle,
                MarkerSize = 2,
                MarkerFill = OxyColor.FromRgb(79, 129, 189)
            };

            model.Series.Add(series);

            foreach (filterReportDS.MdsCoordsRow dr in Data.MdsCoords.Rows)
            {
                var annotation = new OxyPlot.Annotations.TextAnnotation
                {
                    Text                    = dr.StrategyName,
                    TextPosition            = new DataPoint(dr.X, dr.Y),
                    TextHorizontalAlignment = OxyPlot.HorizontalAlignment.Center,
                    TextVerticalAlignment   = OxyPlot.VerticalAlignment.Top,
                    Font                    = "Segoe UI",
                    TextColor               = OxyColor.FromRgb(0, 0, 0),
                    StrokeThickness         = 0
                };

                model.Annotations.Add(annotation);
            }

            MdsChartModel = model;
        }
Esempio n. 5
0
        /// <summary>
        /// This method paints the circle of the earth
        /// </summary>
        /// <param name="orbitModel"></param>
        private void GetEarthPainted(PlotModel orbitModel)
        {
            OxyPlot.Annotations.EllipseAnnotation earth = new OxyPlot.Annotations.EllipseAnnotation();

            earth.Fill   = OxyColor.FromRgb(0, 0, 0);
            earth.Width  = 2 * Sat_Constants.EARTH_RADIOUS_constant * 1000;
            earth.Height = 2 * Sat_Constants.EARTH_RADIOUS_constant * 1000;

            orbitModel.Annotations.Add(earth);

            OxyPlot.Series.ScatterSeries serie = new OxyPlot.Series.ScatterSeries();
            serie.Points.Add(new OxyPlot.Series.ScatterPoint(0, 0));

            orbitModel.Series.Add(serie);
        }
Esempio n. 6
0
        public void GetEarth()
        {
            OxyPlot.Annotations.EllipseAnnotation earth = new OxyPlot.Annotations.EllipseAnnotation();

            earth.Fill   = OxyColor.FromRgb(0, 0, 0);
            earth.Width  = 2 * Sat_Constants.EARTH_RADIOUS_constant * 1000;
            earth.Height = 2 * Sat_Constants.EARTH_RADIOUS_constant * 1000;

            orbitModel.Annotations.Add(earth);

            OxyPlot.Series.ScatterSeries serie = new OxyPlot.Series.ScatterSeries();
            serie.Points.Add(new OxyPlot.Series.ScatterPoint(0, 0));

            orbitModel.Series.Add(serie);

            //OxyPlot.Series.LineSeries serie = new OxyPlot.Series.LineSeries();

            //serie.MarkerSize = 1;
            //serie.MarkerStroke = OxyColor.FromRgb(255, 0, 0);
            //serie.MarkerStrokeThickness = 1;
            ////serie.MarkerType = MarkerType.None;

            //double a = _tle_dataset._TLE_Sat_Selected.Sat_SemiAxis;
            //double ecc = _tle_dataset._TLE_Sat_Selected.Sat_Eccentricity;
            //double b = a * Math.Pow(1 - Math.Pow(ecc, 2), 0.5);

            //orbitModel.Axes.Add(new LinearAxis { Position = AxisPosition.Bottom, MaximumPadding = 0.1, MinimumPadding = 0.1 });
            //orbitModel.Axes.Add(new LinearAxis { Position = AxisPosition.Left, MaximumPadding = 0.1, MinimumPadding = 0.1 });

            //OxyPlot.Annotations.EllipseAnnotation ellipse = new OxyPlot.Annotations.EllipseAnnotation();
            //ellipse.Width = a/2;
            //ellipse.Height = b/2;
            //ellipse.Fill = OxyColor.FromRgb(0, 255, 0);

            //orbitModel.Annotations.Add(ellipse);


            //for (int j = 0; j < 360; j++)
            //{
            //	double rad = (double)j * (double)2 * Math.PI / (double)360;
            //	double x = a * Math.Cos(j);
            //	double y = b * Math.Sin(j);
            //	OxyPlot.DataPoint point = new OxyPlot.DataPoint(x, y);
            //	serie.Points.Add(point);
            //}

            //orbitModel.Series.Add(serie);
        }
Esempio n. 7
0
        public PlotWindow(List <List <double> > results)
        {
            var plotModel = new OxyPlot.PlotModel();

            plotModel.Title          = "Cats And Dogs";
            plotModel.LegendPosition = OxyPlot.LegendPosition.BottomRight;

            plotModel.Axes.Add(new OxyPlot.Axes.LinearAxis()
            {
                Position = OxyPlot.Axes.AxisPosition.Left,
                Title    = "Accuracy",
                Minimum  = 0,
                Maximum  = 1,
            });
            plotModel.Axes.Add(new OxyPlot.Axes.LinearAxis()
            {
                Position = OxyPlot.Axes.AxisPosition.Bottom,
                Minimum  = 0,
                Maximum  = results[0].Count + 1,
                Title    = "Epochs"
            });

            var labels      = new string[] { "Train Set", "Validation Set" };
            var markerTypes = new OxyPlot.MarkerType[] { OxyPlot.MarkerType.Plus, OxyPlot.MarkerType.Circle };

            for (int row = 0; row < results.Count; row++)
            {
                var scatterSeries = new OxyPlot.Series.ScatterSeries()
                {
                    MarkerType   = markerTypes[row],
                    MarkerStroke = OxyPlot.OxyColors.Blue,
                    MarkerFill   = OxyPlot.OxyColors.Black
                };
                scatterSeries.ItemsSource = results[row].Select((value, index) => new OxyPlot.Series.ScatterPoint(index + 1, value));
                scatterSeries.Title       = labels[row];
                plotModel.Series.Add(scatterSeries);
            }

            var plotView = new OxyPlot.Wpf.PlotView();

            plotView.Model = plotModel;

            Title   = "Chart";
            Content = plotView;
        }
Esempio n. 8
0
        public PlotWindow(List <List <double> > results)
        {
            var plotModel = new OxyPlot.PlotModel();

            plotModel.Title = "Overfitting and Underfitting";

            plotModel.Axes.Add(new OxyPlot.Axes.LinearAxis()
            {
                Position = OxyPlot.Axes.AxisPosition.Left,
                Title    = "Validation Loss",
                Minimum  = 0,
                Maximum  = 1,
            });
            plotModel.Axes.Add(new OxyPlot.Axes.LinearAxis()
            {
                Position = OxyPlot.Axes.AxisPosition.Bottom,
                Minimum  = 0,
                Maximum  = results[0].Count + 1,
                Title    = "Epochs"
            });

            var labels      = new string[] { "Original Model", "Dropout-regularized model" };
            var markerTypes = new OxyPlot.MarkerType[] { OxyPlot.MarkerType.Plus, OxyPlot.MarkerType.Circle };

            for (int row = 0; row < results.Count; row++)
            {
                var scatterSeries = new OxyPlot.Series.ScatterSeries()
                {
                    MarkerType   = markerTypes[row],
                    MarkerStroke = OxyPlot.OxyColors.Blue,
                    MarkerFill   = OxyPlot.OxyColors.Blue
                };
                scatterSeries.ItemsSource = results[row].Select((value, index) => new OxyPlot.Series.ScatterPoint(index + 1, value));
                scatterSeries.Title       = labels[row];
                plotModel.Series.Add(scatterSeries);
            }

            var plotView = new OxyPlot.Wpf.PlotView();

            plotView.Model = plotModel;

            Title   = "Chart";
            Content = plotView;
        }
        private void Initialize_EnergyScalePlot_Base(PlotModel energyscale_plot, OxyPlot.Series.ScatterSeries[] energyscale_data, State_Variables state, bool color_flag)
        {
            //scaletime_plot.PlotAreaBorderThickness = new OxyThickness(0.0);
            energyscale_plot.PlotMargins     = new OxyThickness(8.0);
            energyscale_plot.TitleFontWeight = 5;

            OxyPlot.Axes.LinearAxis x = new OxyPlot.Axes.LinearAxis();
            x.Maximum = State.Num_ScaleBins;
            x.Minimum = 0.0;
            x.PositionAtZeroCrossing = true;
            x.Position                = OxyPlot.Axes.AxisPosition.Bottom;
            x.AxislineThickness       = 0.5;
            x.AxislineColor           = OxyColors.Black;
            x.TickStyle               = OxyPlot.Axes.TickStyle.Crossing;
            x.AxisTickToLabelDistance = 0.0;
            x.FontSize                = 8.0;
            energyscale_plot.Axes.Add(x);

            OxyPlot.Axes.LinearAxis y = new OxyPlot.Axes.LinearAxis();
            y.PositionAtZeroCrossing = true;
            y.MajorGridlineStyle     = LineStyle.Solid;
            y.MinorGridlineStyle     = LineStyle.Dot;
            y.AxislineThickness      = 0.5;
            y.AxislineColor          = OxyColors.Black;
            y.TickStyle = OxyPlot.Axes.TickStyle.Crossing;
            y.AxisTickToLabelDistance = 0.0;
            y.FontSize = 8.0;
            energyscale_plot.Axes.Add(y);

            for (int i = 0; i < state.Num_Points; i++)
            {
                energyscale_data[i]            = new OxyPlot.Series.ScatterSeries();
                energyscale_data[i].MarkerType = MarkerType.Circle;
                energyscale_data[i].MarkerSize = 2;
                if (!color_flag)
                {
                    energyscale_data[i].MarkerFill = OxyColors.Black;
                }

                energyscale_plot.Series.Add(energyscale_data[i]);
            }

            //energyscale_plot.MouseLeave += EnergyScalePlot_MouseLeave;
        }
Esempio n. 10
0
        private void AddScatterSeries(List <GPoint> points, string title, MarkerType markerType = MarkerType.Diamond)
        {
            var scatterSeries = new OxyPlot.Series.ScatterSeries()
            {
                Title      = title,
                MarkerType = markerType,
            };

            if (markerType != MarkerType.Diamond)
            {
                scatterSeries.MarkerStroke = OxyPlot.OxyColors.Blue;
            }

            foreach (var p in points)
            {
                scatterSeries.Points.Add(new OxyPlot.Series.ScatterPoint(p.X, p.Y));
            }

            base.Series.Add(scatterSeries);
        }
Esempio n. 11
0
        public static OxyPlot.PlotModel CreatePlotModel(IList <KeyValuePair <DateTime, Tuple <double, double>[]> > u)
        {
            var pm            = new OxyPlot.PlotModel();
            var scatterSeries = new OxyPlot.Series.ScatterSeries {
                MarkerType = OxyPlot.MarkerType.Circle
            };
            var first = u.First().Key;

            scatterSeries.Points.AddRange(u.SelectMany(_ =>
            {
                return(_.Value.Select(__ =>
                {
                    var size = 2;
                    var colorValue = __.Item2;
                    return new OxyPlot.Series.ScatterPoint((_.Key - first).TotalDays, __.Item1, size, colorValue);
                }));
            }));

            //scatterSeries.Points=cx;

            pm.Series.Add(scatterSeries);

            return(pm);
        }
        protected virtual PlotSignalModel internalAddSignal(ISignalViewModel signal, Axis lastDroppedAxis)
        {
            PlotSignalModel ps = new PlotSignalModel()
            {
                Path = signal.GetPath(), Axis = lastDroppedAxis.Key
            };
            var ax = PlotModel.GetAxisOrDefault(ps.Axis, xAxis);

            ax.Title = signal.Title;

            if (lastDroppedAxis == xAxis)
            {
                xSignal = signal;
                //var ySignal = (from PlotSignalModel s in model.Signals where s.Axis == "Y" select s).First();
            }
            else if (lastDroppedAxis == yAxis)
            {
                ySignal = signal;
            }

            if (xSignal == null || ySignal == null)
            {
                PlotModel.InvalidatePlot(true);
                return(ps);
            }

            var xdata = xSignal.GetData();
            var ydata = ySignal.GetData();

            var scatterSerie = new OxyPlot.Series.ScatterSeries()
            {
                MarkerType   = OxyPlot.MarkerType.Cross,
                MarkerSize   = 2,
                MarkerStroke = OxyColors.Blue,
                //Title = xSignal.Title + "/" + ySignal.Title,
                TrackerFormatString = "{1}: \t{2}\n{3}: \t{4}"
            };

            // Find pixel size here
            scatterSerie.BinSize = 4;

            List <DataPoint> dataPoints = new List <DataPoint>(xdata.GetLength(0));

            for (int i = 0; i < xdata.GetLength(0); i++)
            {
                DataPoint dp = new DataPoint();
                dp.X            = xdata[i].Value;
                dp.Y            = ydata[i].Value;
                dp.T            = xdata[i].Time;
                dp.ScatterPoint = new OxyPlot.Series.ScatterPoint(xdata[i].Value, ydata[i].Value);
                dataPoints.Add(dp);
                //scatterSerie.Points.Add(new OxyPlot.Series.ScatterPoint(xdata[i].Value, ydata[i].Value,double.NaN, double.NaN, xdata[i].Time));
            }
            scatterSerie.ItemsSource = dataPoints;
            scatterSerie.Mapping     = Filter;
            scatterSerie.XAxisKey    = "X";
            scatterSerie.YAxisKey    = "Y";

            PlotModel.Series.Add(scatterSerie);

            //double a, b;
            //LeastSquaresFit(scatterSerie.Points, out a, out b);
            //PlotModel.Annotations.Add(new LineAnnotation { Slope = a, Intercept = b, Text = "Least squares fit" });
            PlotModel.InvalidatePlot(true);
            return(ps);
        }
        private Series ConvertSeries(ChartSeriesViewModel series)
        {
            Series newSeries   = null;
            var    valueSeries = series.GetScaleForProperty(series.ValueMemberPath);
            var    labelSeries = series.GetScaleForProperty(series.LabelMemberPath);


            switch (series.SeriesType)
            {
            case (ChartSeriesType.Column):
            {
                newSeries = new ColumnSeries
                {
                    ValueField  = series.ValueMemberPath,
                    ItemsSource = series.DataSource.Data,
                    FillColor   = valueSeries.Color.ToOxyColor(),
                    StrokeColor = valueSeries.Color.ToOxyColor(),
                    YAxisKey    = valueSeries.Name,
                    XAxisKey    = labelSeries.Name,
                };

                break;
            }

            case (ChartSeriesType.Line):
            {
                newSeries = new LineSeries
                {
                    ItemsSource = series.DataSource.Data,
                    DataFieldX  = series.XMemberPath,
                    DataFieldY  = series.YMemberPath,
                    MarkerType  = MarkerType.Circle,
                    Color       = valueSeries.Color.ToOxyColor(),
                    MarkerFill  = valueSeries.Color.ToOxyColor(),
                    YAxisKey    = valueSeries.Name,
                    XAxisKey    = labelSeries.Name,
                };
                break;
            }

            case (ChartSeriesType.Spline):
            {
                newSeries = new LineSeries
                {
                    ItemsSource = series.DataSource.Data,
                    DataFieldX  = series.XMemberPath,
                    DataFieldY  = series.YMemberPath,
                    MarkerType  = MarkerType.Circle,
                    Color       = valueSeries.Color.ToOxyColor(),
                    MarkerFill  = valueSeries.Color.ToOxyColor(),
                    Smooth      = true,
                    YAxisKey    = valueSeries.Name,
                    XAxisKey    = labelSeries.Name,
                };
                break;
            }

            case (ChartSeriesType.Area):
            {
                newSeries = new AreaSeries
                {
                    ItemsSource = series.DataSource.Data,
                    DataFieldX  = series.XMemberPath,
                    DataFieldY  = series.YMemberPath,
                    Color       = valueSeries.Color.ToOxyColor(),
                    Fill        = valueSeries.Color.ToOxyColor(),
                    MarkerFill  = valueSeries.Color.ToOxyColor(),
                    YAxisKey    = valueSeries.Name,
                    XAxisKey    = labelSeries.Name,
                };
                break;
            }

            case (ChartSeriesType.SplineArea):
            {
                newSeries = new AreaSeries
                {
                    ItemsSource = series.DataSource.Data,
                    DataFieldX  = series.XMemberPath,
                    DataFieldY  = series.YMemberPath,
                    Color       = valueSeries.Color.ToOxyColor(),
                    Fill        = valueSeries.Color.ToOxyColor(),
                    MarkerFill  = valueSeries.Color.ToOxyColor(),
                    Smooth      = true,
                    YAxisKey    = valueSeries.Name,
                    XAxisKey    = labelSeries.Name,
                };
                break;
            }

            case (ChartSeriesType.Bubble):
            {
                newSeries = new ScatterSeries
                {
                    ItemsSource   = series.DataSource.Data,
                    DataFieldX    = series.XMemberPath,
                    DataFieldY    = series.YMemberPath,
                    DataFieldSize = series.RadiusMemberPath,
                    MarkerFill    = valueSeries.Color.ToOxyColor(),
                    MarkerType    = MarkerType.Circle,
                    YAxisKey      = valueSeries.Name,
                    XAxisKey      = labelSeries.Name,
                };
                break;
            }

            case (ChartSeriesType.StepLine):
            {
                newSeries = new StairStepSeries
                {
                    ItemsSource = series.DataSource.Data,
                    DataFieldX  = series.XMemberPath,
                    DataFieldY  = series.YMemberPath,
                    Color       = valueSeries.Color.ToOxyColor(),
                    YAxisKey    = valueSeries.Name,
                    XAxisKey    = labelSeries.Name,
                };
                break;
            }

            default:
            {
                return(null);
            }
            }

            newSeries.Title = series.Name;

            return(newSeries);
        }
Esempio n. 14
0
 public void ScatterSeries()
 {
     var s1 = new OxyPlot.Series.ScatterSeries();
     var s2 = new ScatterSeries();
     OxyAssert.PropertiesAreEqual(s1, s2);
 }
Esempio n. 15
0
        private void btn_ExportPNG_Click(object sender, EventArgs e)
        {
            if (loaded.Count < 2)
            {
                Log.LogMessage("You must load all data before exporting!");
                return;
            }

            int height = 0;
            if (!int.TryParse(txt_height.Text, out height))
            {
                Log.LogMessage("Height must be an integer");
                return;
            }

            int width = 0;
            if (!int.TryParse(txt_width.Text, out width))
            {
                Log.LogMessage("Width must be an integer");
                return;
            }

            int offset = 0;
            if (!int.TryParse(txt_PlotDataOffset.Text, out offset))
            {
                Log.LogMessage("Offset must be an integer");
                return;
            }

            double pointSize = 0;
            if (!double.TryParse(txt_PlotPointSize.Text.Replace(".", ","), out pointSize))
            {
                Log.LogMessage("Point size must be a double");
                return;
            }

            int from = -1;
            if (!int.TryParse(txt_ExportFrom.Text, out from) || txt_ExportFrom.Text == "")
            {
                Log.LogMessage("Export from not valid integer, using 0");
                from = -1;
            }

            int to = -1;
            if (!int.TryParse(txt_ExportTo.Text, out to) || txt_ExportTo.Text == "")
            {
                Log.LogMessage("Export to not valid integer, using max");
                to = -1;
            }

            SaveFileDialog sfd = new SaveFileDialog();
            sfd.DefaultExt = ".png";
            sfd.Filter = "png|*.png";

            if (sfd.ShowDialog() == DialogResult.OK)
            {
                PngExporter pngify = new PngExporter();
                pngify.Width = width;
                pngify.Height = height;

                var xy = GetXY(from, to);

                var test = xy.Item1;
                var recall = xy.Item2;

                FitPlot(test, recall);

                var model = new PlotModel() { Title = $"Slope:{slope.ToString("0.000")} RSquared:{rsquared.ToString("0.000")}" };
                var dataSeries = new OxyPlot.Series.ScatterSeries() { MarkerType = MarkerType.Circle, MarkerStroke = OxyColors.Red };
                for (int i = 0; i < test.Count; i++)
                {
                    dataSeries.Points.Add(new OxyPlot.Series.ScatterPoint(test[i], recall[i]) { Size = pointSize });
                }

                var fitSeries = new OxyPlot.Series.FunctionSeries((x) => intercept + slope * x, test.Min(), test.Max(), 0.001) { Color = OxyColors.Blue };

                model.Series.Add(dataSeries);
                model.Series.Add(fitSeries);

                model.Axes.Add(new OxyPlot.Axes.LinearAxis() { Minimum = 0, Maximum = 1, Position = OxyPlot.Axes.AxisPosition.Left });
                model.Axes.Add(new OxyPlot.Axes.LinearAxis() { Minimum = 0, Maximum = 1, Position = OxyPlot.Axes.AxisPosition.Bottom });

                pngify.ExportToFile(model, sfd.FileName);
                Log.LogMessage("Saved " + sfd.FileName + "!");
            }
        }
Esempio n. 16
0
        static void SavePngScatter(string path, string name, List<double> A, List<double> B, double axisMin = 0, double axisMax = 0)
        {
            PngExporter pngify = new PngExporter();
            pngify.Width = 2000;
            pngify.Height = 2000;

            var model = new PlotModel() { Title = name };

            var scatterSeries = new OxyPlot.Series.ScatterSeries()
            {
                MarkerSize = 0.8f,
                MarkerType = MarkerType.Circle,
                MarkerFill = OxyColors.Black
            };

            for (int i = 0; i < A.Count && i < B.Count; i++)
            {
                scatterSeries.Points.Add(new OxyPlot.Series.ScatterPoint(A[i], B[i]));
            }

            model.Series.Add(scatterSeries);
            model.Axes.Add(new OxyPlot.Axes.LinearAxis() { Minimum = axisMin, Maximum = axisMax, Position = OxyPlot.Axes.AxisPosition.Left });
            model.Axes.Add(new OxyPlot.Axes.LinearAxis() { Minimum = axisMin, Maximum = axisMax, Position = OxyPlot.Axes.AxisPosition.Bottom });

            pngify.ExportToFile(model, path);
        }
        private Series ConvertSeries(ChartSeriesViewModel series)
        {
            Series newSeries = null;
            var valueSeries = series.GetScaleForProperty(series.ValueMemberPath);
            var labelSeries = series.GetScaleForProperty(series.LabelMemberPath);

            switch (series.SeriesType)
            {
                case( ChartSeriesType.Column):
                {
                    newSeries = new ColumnSeries
                    {
                        ValueField = series.ValueMemberPath,
                        ItemsSource = series.DataSource.Data,
                        FillColor = valueSeries.Color.ToOxyColor(),
                        StrokeColor = valueSeries.Color.ToOxyColor(),
                        YAxisKey = valueSeries.Name,
                        XAxisKey = labelSeries.Name,
                    };

                    break;
                }
                case( ChartSeriesType.Line ):
                {
                    newSeries = new LineSeries
                    {
                        ItemsSource = series.DataSource.Data,
                        DataFieldX = series.XMemberPath,
                        DataFieldY = series.YMemberPath,
                        MarkerType = MarkerType.Circle,
                        Color = valueSeries.Color.ToOxyColor(),
                        MarkerFill = valueSeries.Color.ToOxyColor(),
                        YAxisKey = valueSeries.Name,
                        XAxisKey = labelSeries.Name,
                    };
                    break;
                }
                case( ChartSeriesType.Spline):
                {
                    newSeries = new LineSeries
                    {
                        ItemsSource = series.DataSource.Data,
                        DataFieldX = series.XMemberPath,
                        DataFieldY = series.YMemberPath,
                        MarkerType = MarkerType.Circle,
                        Color = valueSeries.Color.ToOxyColor(),
                        MarkerFill = valueSeries.Color.ToOxyColor(),
                        Smooth = true,
                        YAxisKey = valueSeries.Name,
                        XAxisKey = labelSeries.Name,
                    };
                    break;
                }
                case(ChartSeriesType.Area):
                {
                    newSeries = new AreaSeries
                    {
                        ItemsSource = series.DataSource.Data,
                        DataFieldX = series.XMemberPath,
                        DataFieldY = series.YMemberPath,
                        Color = valueSeries.Color.ToOxyColor(),
                        Fill = valueSeries.Color.ToOxyColor(),
                        MarkerFill = valueSeries.Color.ToOxyColor(),
                        YAxisKey = valueSeries.Name,
                        XAxisKey = labelSeries.Name,
                    };
                    break;
                }
                case( ChartSeriesType.SplineArea):
                {
                    newSeries = new AreaSeries
                    {
                        ItemsSource = series.DataSource.Data,
                        DataFieldX = series.XMemberPath,
                        DataFieldY = series.YMemberPath,
                        Color = valueSeries.Color.ToOxyColor(),
                        Fill = valueSeries.Color.ToOxyColor(),
                        MarkerFill = valueSeries.Color.ToOxyColor(),
                        Smooth = true,
                        YAxisKey = valueSeries.Name,
                        XAxisKey = labelSeries.Name,
                    };
                    break;
                }
                case(ChartSeriesType.Bubble):
                {
                    newSeries = new ScatterSeries
                    {
                        ItemsSource = series.DataSource.Data,
                        DataFieldX = series.XMemberPath,
                        DataFieldY = series.YMemberPath,
                        DataFieldSize = series.RadiusMemberPath,
                        MarkerFill = valueSeries.Color.ToOxyColor(),
                        MarkerType = MarkerType.Circle,
                        YAxisKey = valueSeries.Name,
                        XAxisKey = labelSeries.Name,
                    };
                    break;
                }
                case( ChartSeriesType.StepLine):
                {
                    newSeries = new StairStepSeries
                    {
                        ItemsSource = series.DataSource.Data,
                        DataFieldX = series.XMemberPath,
                        DataFieldY = series.YMemberPath,
                        Color = valueSeries.Color.ToOxyColor(),
                        YAxisKey = valueSeries.Name,
                        XAxisKey = labelSeries.Name,
                    };
                    break;
                }
                default:
                {
                    return null;
                }
            }

            newSeries.Title = series.Name;

            return newSeries;
        }
Esempio n. 18
0
 public EnergyTimePlotWiring(PlotModel pm, OxyPlot.Series.ScatterSeries[] energy, OxyPlot.Series.ScatterSeries total_energy) : base(pm, energy)
 {
     Total_Energy         = total_energy;
     ClassicalEnergy_Line = false;
 }