public void ChangeViewModel(ScatterSeries items) { this.Items = items; var model = new PlotModel { Title = "" }; model.Series.Add(items); var customAxis = new RangeColorAxis { Key = "customColors" }; customAxis.AddRange(0, 0.1, OxyColors.Red); customAxis.AddRange(0.2, 0.3, OxyColors.Yellow); customAxis.AddRange(0.4, 0.5, OxyColors.LightGreen); customAxis.AddRange(0.6, 0.7, OxyColors.Orange); customAxis.AddRange(0.8, 0.9, OxyColors.Blue); customAxis.AddRange(1.0, 1.1, OxyColors.DarkOliveGreen); customAxis.AddRange(1.2, 1.3, OxyColors.Black); customAxis.AddRange(1.4, 1.5, OxyColors.Violet); customAxis.AddRange(1.6, 1.7, OxyColors.Brown); customAxis.AddRange(1.8, 1.9, OxyColors.Cyan); model.Axes.Add(customAxis); //model.Axes.Add(new LinearAxis { Position = AxisPosition.Bottom, Title = "Liczba sąsiadów", MajorTickSize = 0.1, Minimum = 0, Maximum = 25 }); //model.Axes.Add(new LinearAxis { Position = AxisPosition.Left, Title = " Jakość", MajorTickSize = 0.1, Minimum = 0, Maximum = 10 }); this.MyModel = model; this.MyModel.InvalidatePlot(true); }
public ScatterPlotViewModel() { var model = new PlotModel { Title = "" }; var scatterSeries = new ScatterSeries { MarkerType = MarkerType.Circle }; this.Items = scatterSeries; model.Series.Add(scatterSeries); var customAxis = new RangeColorAxis { Key = "customColors" }; customAxis.AddRange(0, 0.1, OxyColors.Red); customAxis.AddRange(0.2, 0.3, OxyColors.Yellow); customAxis.AddRange(0.4, 0.5, OxyColors.Green); customAxis.AddRange(0.6, 0.7, OxyColors.Orange); customAxis.AddRange(0.8, 0.9, OxyColors.Blue); customAxis.AddRange(1.0, 1.1, OxyColors.DarkOliveGreen); customAxis.AddRange(1.2, 1.3, OxyColors.Black); customAxis.AddRange(1.4, 1.5, OxyColors.Violet); customAxis.AddRange(1.6, 1.7, OxyColors.Brown); customAxis.AddRange(1.8, 1.9, OxyColors.Cyan); model.Axes.Add(customAxis); this.MyModel = model; }
private static PlotModel RangeColorAxis(AxisPosition position, bool reverseAxis) { int n = 1000; string modelTitle = reverseAxis ? string.Format("ScatterSeries and Reversed RangeColorAxis (n={0})", n) : string.Format("ScatterSeries and RangeColorAxis (n={0})", n); var model = new PlotModel { Title = modelTitle, Background = OxyColors.LightGray }; model.Axes.Add(new LinearAxis { Position = AxisPosition.Bottom }); model.Axes.Add(new LinearAxis { Position = AxisPosition.Left }); var rca = new RangeColorAxis { Position = position, Maximum = 2, Minimum = -2 }; rca.AddRange(0, 0.5, OxyColors.Blue); rca.AddRange(-0.2, -0.1, OxyColors.Red); if (reverseAxis) { rca.StartPosition = 1; rca.EndPosition = 0; } model.Axes.Add(rca); var s1 = new ScatterSeries { MarkerType = MarkerType.Square, MarkerSize = 6, }; var random = new Random(13); 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); }
public Visualization() { Plots = new List <PlotView>(); _colorKey = new Dictionary <OxyColor, double>(); _colorAxis = new RangeColorAxis { Key = ColorAxisName }; var fieldInfos = typeof(OxyColors).GetFields(BindingFlags.Static | BindingFlags.Public); var rangeStart = 0.0; foreach (var fieldInfo in fieldInfos) { var oxyColor = (OxyColor)fieldInfo.GetValue(null); if (_colorKey.ContainsKey(oxyColor)) { continue; } _colorAxis.AddRange(rangeStart, rangeStart + 0.1, oxyColor); _colorKey.Add(oxyColor, rangeStart); rangeStart++; } Application.EnableVisualStyles(); }
public static PlotModel CreateScatterPlotInvX() { var plotModel = new PlotModel(); var color_axis = new LinearColorAxis { Key = "ColorAxis", Maximum = 1, Minimum = 0, Position = AxisPosition.None }; plotModel.Axes.Add(color_axis); var customAxis = new RangeColorAxis() { Key = "customColors", Position = AxisPosition.None }; customAxis.AddRange(0, 50, OxyColors.LightGreen); customAxis.AddRange(50, 100, OxyColors.Green); customAxis.AddRange(100, 200, OxyColors.DarkGreen); customAxis.AddRange(200, 300, OxyColors.Orange); customAxis.AddRange(300, 500, OxyColors.DarkOrange); customAxis.AddRange(500, 100000, OxyColors.DarkRed); plotModel.Axes.Add(customAxis); var x_axis = new LinearAxis { Position = OxyPlot.Axes.AxisPosition.Bottom, ExtraGridlines = new double[] { 0 }, ExtraGridlineThickness = 1, ExtraGridlineColor = OxyColors.DimGray, StartPosition = 1, EndPosition = 0 }; plotModel.Axes.Add(x_axis); var y_axis = new LinearAxis { Position = AxisPosition.Left, ExtraGridlines = new double[] { 0 }, ExtraGridlineThickness = 1, ExtraGridlineColor = OxyColors.DimGray, StartPosition = 1, EndPosition = 0 }; plotModel.Axes.Add(y_axis); return(plotModel); }
public Visualization(BenchmarkType benchmarkType) { Plots = new List <PlotView>(); _colorKey = new Dictionary <OxyColor, double>(); _colorAxis = new RangeColorAxis { Key = ColorAxisName }; var fieldInfos = typeof(OxyColors).GetFields(BindingFlags.Static | BindingFlags.Public); var rangeStart = 0.0; foreach (var fieldInfo in fieldInfos) { var oxyColor = (OxyColor)fieldInfo.GetValue(null); if (_colorKey.ContainsKey(oxyColor)) { continue; } _colorAxis.AddRange(rangeStart, rangeStart + 0.1, oxyColor); _colorKey.Add(oxyColor, rangeStart); rangeStart++; } switch (benchmarkType) { case BenchmarkType.Balln: _plotWidth = 400; _plotHeight = 400; _xAxisMin = -5; _xAxisMax = 7; _yAxisMin = -4; _yAxisMax = 8; break; case BenchmarkType.Cuben: _plotWidth = 400; _plotHeight = 400; _xAxisMin = -2; _xAxisMax = 6.6; _yAxisMin = -4.5; _yAxisMax = 13.5; break; case BenchmarkType.Simplexn: _plotWidth = 400; _plotHeight = 400; _xAxisMin = -1.5; _xAxisMax = 5; _yAxisMin = -1.5; _yAxisMax = 5; break; case BenchmarkType.Other: _plotWidth = 400; _plotHeight = 400; _xAxisMin = -100; _xAxisMax = 100; _yAxisMin = -100; _yAxisMax = 100; break; default: throw new ArgumentOutOfRangeException(nameof(benchmarkType), benchmarkType, null); } Application.EnableVisualStyles(); }