public override View GetSampleContent(Context context) { var chart = new SfChart(context);; chart.SetBackgroundColor(Color.White); chart.PrimaryAxis = new CategoryAxis { ShowMajorGridLines = false, PlotOffset = 20 }; chart.SecondaryAxis = new NumericalAxis() { ShowMajorGridLines = false, PlotOffset = 20 }; var datas = new ObservableArrayList(); datas.Add(new ChartDataPoint("2005", 54)); datas.Add(new ChartDataPoint("2006", 34)); datas.Add(new ChartDataPoint("2007", 53)); datas.Add(new ChartDataPoint("2008", 63)); datas.Add(new ChartDataPoint("2009", 35)); datas.Add(new ChartDataPoint("2010", 27)); datas.Add(new ChartDataPoint("2011", 13)); datas.Add(new ChartDataPoint("2012", 40)); datas.Add(new ChartDataPoint("2013", 25)); var scatterSeries = new ScatterSeries { DataSource = datas, ScatterHeight = 20, ScatterWidth = 20 }; scatterSeries.DataMarker.ShowLabel = true; chart.Series.Add(scatterSeries); return chart; }
private static PlotModel RangeColorAxis(AxisPosition position) { int n = 1000; var model = new PlotModel { Title = string.Format("ScatterSeries and RangeColorAxis (n={0})", n), 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); 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 GraphComponents(OxyColor color) { scatters = new ScatterSeries { BinSize = 8, MarkerFill = color, MarkerSize = 2.0, MarkerStroke = color, MarkerStrokeThickness = 1.0, MarkerType = MarkerType.Circle }; lines = new LineSeries { Color = color, LineStyle = LineStyle.Solid, StrokeThickness = 1.0, Smooth = true }; stems = new StemSeries { Color = color, StrokeThickness = 1.0, }; }
public void AddSeries(IEnumerable<double> x, IEnumerable<double> y, string title, OxyColor fill) { var series = new ScatterSeries { MarkerFill = fill, MarkerSize = 2, MarkerStrokeThickness = 0, MarkerType = MarkerType.Diamond, Title = title }; double[] xPoints = x as double[] ?? x.ToArray(); double[] yPoints = y as double[] ?? y.ToArray(); if (xPoints.Length != yPoints.Length) throw new Exception("The two data arrays must be of equal length."); for (int i = 0; i < xPoints.Length; i++) { var point = new ScatterPoint(xPoints[i], yPoints[i]); series.Points.Add(point); } Model.Series.Add(series); }
public void AddSeries(ScatterSeries s) { s.MarkerFill = colors[plot.Series.Count() % colors.Count()].ToOxyColor(); plot.Series.Add(s); this.Root.Model = plot; }
private void UpdatePlot() { var pm = new PlotModel { Title = this.year.ToString(), Subtitle = "data from gapminder.org", LegendPosition = LegendPosition.RightBottom }; var ss = new ScatterSeries { MarkerType = MarkerType.Circle, MarkerFill = OxyColors.Transparent, MarkerStroke = OxyColors.Blue, MarkerStrokeThickness = 1 }; var piX = typeof(Statistics).GetProperty("GdpPerCapitaPpp"); var piY = typeof(Statistics).GetProperty("LifeExpectancyAtBirth"); var piSize = typeof(Statistics).GetProperty("Population"); var piColor = typeof(Statistics).GetProperty("GeographicRegion"); foreach (var kvp in Countries) { Country country = kvp.Value; double x = country.FindValue(year, piX); double y = country.FindValue(year, piY); double size = country.FindValue(year, piSize); if (double.IsNaN(x) || double.IsNaN(y)) continue; ss.Points.Add(new ScatterPoint(x, y, double.NaN, double.NaN, country.Name)); //double radius = 4; //if (!double.IsNaN(size)) // radius = Math.Sqrt(size)*0.1; //if (radius < 4) radius = 4; //if (radius > 40) radius = 40; //ss.MarkerSizes.Add(radius); // Debug.WriteLine(countryName+": "+stats.Population); } pm.Series.Add(ss); if (SelectedCountry != null) { var ls = new LineSeries { Title = SelectedCountry.Name }; ls.LineJoin = LineJoin.Bevel; foreach (var p in SelectedCountry.Statistics) { if (double.IsNaN(p.GdpPerCapitaPpp) || double.IsNaN(p.LifeExpectancyAtBirth)) continue; ls.Points.Add(new DataPoint(p.GdpPerCapitaPpp, p.LifeExpectancyAtBirth)); } pm.Series.Add(ls); var ss2 = new ScatterSeries(); double x = SelectedCountry.FindValue(year, piX); double y = SelectedCountry.FindValue(year, piY); ss2.Points.Add(new ScatterPoint(x, y, 10)); ss2.MarkerFill = OxyColor.FromAColor(120, OxyColors.Red); ss2.MarkerType = MarkerType.Circle; pm.Series.Add(ss2); } pm.Axes.Add(new LinearAxis { Position = AxisPosition.Left, Minimum = 19, Maximum = 87, Title = "Life expectancy (years)" }); pm.Axes.Add(new LogarithmicAxis { Position = AxisPosition.Bottom, Title = "Income per person (GDP/capita, PPP$ inflation-adjusted)", Minimum = 200, Maximum = 90000 }); PlotModel = pm; }
public void CreatePlot(IEnumerable<KeyValuePair <DateTime, Double>> paramCollection, String legendTitle) { //преобразует в dataPoint List<DataPoint> dpList = new List<DataPoint>(50); List<Double> pointsDate = new List<Double>(dpList.Count); var p = new List<ScatterPoint>(); foreach(var v in paramCollection) { dpList.Add(new DataPoint(DateTimeAxis.ToDouble(v.Key), v.Value)); pointsDate.Add(DateTimeAxis.ToDouble(v.Key)); } //добавляет ось со значениями _plotModel.Axes.Add(new DateTimeAxis() { Position = AxisPosition.Bottom, StringFormat = "dd-MM hh-mm" }); _plotModel.Axes.Add(new LinearAxis()); LineSeries ls = new LineSeries(); ScatterSeries css = new ScatterSeries(); foreach (var v in paramCollection) { ScatterPoint sp = new ScatterPoint(DateTimeAxis.ToDouble(v.Key), v.Value); p.Add(sp); } css.ItemsSource = p; ls.ItemsSource = dpList; ls.CanTrackerInterpolatePoints = false; _plotModel.Series.Add(ls); _plotModel.Series.Add(css); //легенда: _plotModel.LegendPosition = LegendPosition.TopCenter; _plotModel.LegendTitle = legendTitle; //сетка: _plotModel.Axes[0].MajorGridlineStyle = LineStyle.None; _plotModel.Axes[0].ExtraGridlines = pointsDate.ToArray<Double>(); _plotModel.Axes[0].ExtraGridlineStyle = LineStyle.Dot; _plotModel.Series[0].SelectionMode = SelectionMode.Single; _plotModel.Axes[1].MajorStep = 10; _plotModel.Axes[1].Maximum = dpList.Max<DataPoint>(point => point.Y) + 10; _plotModel.Axes[1].Minimum = dpList.Min<DataPoint>(dp => dp.Y) - 10; }
public MainViewModel() { this.MyModel = new PlotModel("Example 1"); var scatterseries = new ScatterSeries(); var prnd = new Random(); var i = 0; while (i < 10000) { var pair = Distribution.GaussianSamplePair(0.0, 0.1, prnd); scatterseries.Points.Add(new DataPoint(pair.Key, pair.Value)); i++; } MyModel.Series.Add(scatterseries); }
public static PlotModel StandardCategoryColorAxis() { var plotModel1 = new PlotModel { Title = "CategoryColorAxis" }; var catAxis = new CategoryColorAxis { Key = "ccc", Palette = OxyPalettes.BlackWhiteRed(12) }; catAxis.Labels.AddRange(new[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12" }); plotModel1.Axes.Add(catAxis); var linearAxis = new LinearAxis { Position = AxisPosition.Left }; var ss = new ScatterSeries { ColorAxisKey = catAxis.Key }; ss.Points.Add(new ScatterPoint(0, 0) { Value = 0 }); ss.Points.Add(new ScatterPoint(3, 0) { Value = 3 }); plotModel1.Series.Add(ss); plotModel1.Axes.Add(linearAxis); return plotModel1; }
public MixingTypes() { InitializeComponent(); LineSeries = new LineSeries { Values = new ChartValues <ObservableValue> { new ObservableValue(5), new ObservableValue(7), new ObservableValue(2), new ObservableValue(3), }, Fill = Brushes.Transparent }; ScatterSeries = new ScatterSeries { Values = new ChartValues <BubblePoint> { new BubblePoint(0, 2, 10), new BubblePoint(1, 1, 2), new BubblePoint(2, 3, 7), new BubblePoint(3, 4, 9) } }; ColumnSeries = new ColumnSeries { Values = new ChartValues <ObservableValue> { new ObservableValue(5), new ObservableValue(7), new ObservableValue(2), new ObservableValue(3), } }; SeriesCollection = new SeriesCollection { LineSeries, ScatterSeries, ColumnSeries }; DataContext = this; }
public MixingSeries() { InitializeComponent(); LineSeries = new LineSeries { Values = new ChartValues <ObservableValue> { new ObservableValue(5), new ObservableValue(7), new ObservableValue(2), new ObservableValue(3), }, AreaLimit = 0 }; ScatterSeries = new ScatterSeries { Values = new ChartValues <ScatterPoint> { new ScatterPoint(0, 2, 10), new ScatterPoint(1, 1, 2), new ScatterPoint(2, 3, 7), new ScatterPoint(3, 4, 9) } }; ColumnSeries = new ColumnSeries { Values = new ChartValues <ObservableValue> { new ObservableValue(5), new ObservableValue(7), new ObservableValue(2), new ObservableValue(3), } }; SeriesCollection = new SeriesCollection { LineSeries, ScatterSeries, ColumnSeries }; DataContext = this; }
private void PlotRoute(Tour tour, TextBox textBox, PlotView plotView) { var model = new PlotModel { Title = "TSP in GA" }; var scatterSeries = new ScatterSeries { MarkerType = MarkerType.Circle }; List <DataPoint> dataPoints = new List <DataPoint>(); var lineseries = new LineSeries { LineStyle = LineStyle.DashDot, LineJoin = LineJoin.Bevel, ItemsSource = dataPoints }; if (tour != null) { textBox.Text = tour.ToString(); var r = new Random(314); for (int i = 0; i < tour.TourSize(); i++) { var city = tour.GetCity(i); var x = city.Longitude / Constants.CONVERT_TO_RADIANS; var y = city.Latitude / Constants.CONVERT_TO_RADIANS; dataPoints.Add(new DataPoint(x, y)); var colorValue = r.Next(100, 1000); scatterSeries.Points.Add(new ScatterPoint(x, y, 10, colorValue)); } var sourceCity = tour.GetCity(0); var sourceX = sourceCity.Longitude / Constants.CONVERT_TO_RADIANS; var sourceY = sourceCity.Latitude / Constants.CONVERT_TO_RADIANS; dataPoints.Add(new DataPoint(sourceX, sourceY)); var colorValuer = r.Next(100, 1000); scatterSeries.Points.Add(new ScatterPoint(sourceX, sourceY, 10, colorValuer)); } model.Series.Add(lineseries); model.Series.Add(scatterSeries); model.Axes.Add(new LinearColorAxis { Position = AxisPosition.Right, Palette = OxyPalettes.Jet(256) }); plotView.Model = model; }
public MixingSeries() { InitializeComponent(); LineSeries = new LineSeries { Values = new ChartValues<ObservableValue> { new ObservableValue(5), new ObservableValue(7), new ObservableValue(2), new ObservableValue(3), }, AreaLimit = 0 }; ScatterSeries = new ScatterSeries { Values = new ChartValues<ScatterPoint> { new ScatterPoint(0, 2, 10), new ScatterPoint(1, 1, 2), new ScatterPoint(2, 3, 7), new ScatterPoint(3, 4, 9) } }; ColumnSeries = new ColumnSeries { Values = new ChartValues<ObservableValue> { new ObservableValue(5), new ObservableValue(7), new ObservableValue(2), new ObservableValue(3), } }; SeriesCollection = new SeriesCollection { LineSeries, ScatterSeries, ColumnSeries }; DataContext = this; }
private void LoadScatterChartData(List <Point> points, List <Point> clusters) { ObservableCollection <KeyValuePair <double, double> > points_oc1 = new ObservableCollection <KeyValuePair <double, double> >(); ObservableCollection <KeyValuePair <double, double> > points_oc2 = new ObservableCollection <KeyValuePair <double, double> >(); ObservableCollection <KeyValuePair <double, double> > points_oc3 = new ObservableCollection <KeyValuePair <double, double> >(); ObservableCollection <KeyValuePair <double, double> > points_oc4 = new ObservableCollection <KeyValuePair <double, double> >(); ObservableCollection <KeyValuePair <double, double> > clusters_oc = new ObservableCollection <KeyValuePair <double, double> >(); foreach (Point point in points) { switch (point.Group) { case 1: points_oc1.Add(new KeyValuePair <double, double>(point.X, point.Y)); break; case 2: points_oc2.Add(new KeyValuePair <double, double>(point.X, point.Y)); break; case 3: points_oc3.Add(new KeyValuePair <double, double>(point.X, point.Y)); break; case 4: points_oc4.Add(new KeyValuePair <double, double>(point.X, point.Y)); break; } } foreach (Point point in clusters) { clusters_oc.Add(new KeyValuePair <double, double>(point.X, point.Y)); } ScatterSeries sc = new ScatterSeries(); ; ((ScatterSeries)Voronoi.Series[0]).ItemsSource = points_oc1; ((ScatterSeries)Voronoi.Series[1]).ItemsSource = points_oc2; ((ScatterSeries)Voronoi.Series[2]).ItemsSource = points_oc3; ((ScatterSeries)Voronoi.Series[3]).ItemsSource = points_oc4; ((ScatterSeries)Voronoi.Series[4]).ItemsSource = clusters_oc; }
/// <summary> /// Генерация выборки /// </summary> void GenerateSamaple() { ScatterSeries ss = new ScatterSeries { MarkerSize = 3, MarkerType = MarkerType.Circle, MarkerFill = OxyColor.FromRgb(0, 200, 0) }; for (double i = -1; i < 1; i += Main.DeltaX) { DataPoint dp = new DataPoint(i, Main.Func(i)); Points.Add(dp); ss.Points.Add(new ScatterPoint(dp.X, dp.Y)); } Model.Series.Add(ss); }
private void PrepareDiagram() { var foreground = OxyColors.SteelBlue; var plotModel = new PlotModel { PlotAreaBorderThickness = new OxyThickness(1, 0, 0, 1), PlotAreaBorderColor = foreground }; var linearAxisX = new LinearAxis { Minimum = 0, Maximum = 100, Position = AxisPosition.Bottom, Title = "Spending Score", TextColor = foreground, TicklineColor = foreground, TitleColor = foreground }; plotModel.Axes.Add(linearAxisX); var linearAxisY = new LinearAxis { Minimum = 0, Maximum = 140, Title = "Annual Income", TextColor = foreground, TicklineColor = foreground, TitleColor = foreground }; plotModel.Axes.Add(linearAxisY); for (int i = 0; i < 5; i++) { var series = new ScatterSeries { MarkerType = MarkerType.Circle, MarkerFill = _colors[i] }; plotModel.Series.Add(series); } Diagram.Model = plotModel; }
public Visualization AddPoints(IEnumerable <Point> points, OxyColor color, MarkerType markerType = MarkerType.Circle, double pointSize = 3) { var plot = Plots.Last(); var series = new ScatterSeries { MarkerType = markerType, ColorAxisKey = ColorAxisName }; foreach (var point in points) { series.Points.Add(new ScatterPoint(point.Coordinates[0], point.Coordinates[1], pointSize, _colorKey[color])); } plot.Model.Series.Add(series); return(this); }
private PlotModel HeartRateCreatePlotModel() { HeartRateStreamViewModel heartRateStream = new HeartRateStreamViewModel(); var plotModel = new PlotModel(); plotModel.Axes.Add(new LinearAxis { Position = AxisPosition.Left, Title = "BPM", MaximumPadding = 0.05 }); var dateTimeAxis = new DateTimeAxis() { Position = AxisPosition.Bottom, Title = "Date", StringFormat = DATE_FORMAT, MinimumPadding = 0.05, MaximumPadding = 0.05 }; plotModel.Axes.Add(dateTimeAxis); var series = new ScatterSeries() { MarkerType = MarkerType.Circle, MarkerSize = 4, MarkerStroke = OxyColor.FromRgb(0, 0, 139), // darkblue MarkerFill = OxyColor.FromRgb(255, 165, 0), // orange Background = OxyColor.FromRgb(33, 150, 243), // blue }; List <Entry> entries = heartRateStream.GetEntries(); if (entries != null) { foreach (var entry in entries) { series.Points.Add(new ScatterPoint(DateTimeAxis.ToDouble(entry.date), entry.value)); } } plotModel.Series.Add(series); return(plotModel); }
public SeriesViewModel(IEnumerable <Node> initial) { _scatter = new ScatterSeries { Title = "Points", Values = new ChartValues <ScatterPoint>(initial.Select(n => new ScatterPoint() { X = n.X, Y = n.Y })) }; Series = new SeriesCollection() { _scatter }; }
public MainWindow() { currentIterationsInEpoch = new List <SingleIteration>(); iterationHistory = new List <SingleIteration>(); scatterSeriesAbove = new ScatterSeries { MarkerType = MarkerType.Circle, Title = "Punkty nad granicą decyzyjną (według perceptronu)" }; scatterSeriesBelow = new ScatterSeries { MarkerType = MarkerType.Circle, Title = "Punkty pod granicą decyzyjną (według perceptronu)" }; InitializeComponent(); CultureInfo.CurrentCulture = new CultureInfo("pl-PL"); CultureInfo.CurrentUICulture = new CultureInfo("pl-PL"); xAxis = new LinearAxis { IsZoomEnabled = false, IsPanEnabled = false, Position = AxisPosition.Bottom, Minimum = -13, Maximum = 13, PositionAtZeroCrossing = true, ExtraGridlines = new double[] { 0 } }; plotModel.Axes.Add(xAxis); yAxis = new LinearAxis { IsZoomEnabled = false, IsPanEnabled = false, Position = AxisPosition.Left, Minimum = -13, Maximum = 13, PositionAtZeroCrossing = true, ExtraGridlines = new double[] { 0 } }; plotModel.Axes.Add(yAxis); plotModel.PlotMargins = new OxyPlot.OxyThickness(0); plotModel.Series.Add(scatterSeriesAbove); plotModel.Series.Add(scatterSeriesBelow); plot.LayoutUpdated += plotLayoutUpdated; plot.Model = plotModel; xAxisLearningSet = new LinearAxis { IsZoomEnabled = false, IsPanEnabled = false, Position = AxisPosition.Bottom, Minimum = -13, Maximum = 13, PositionAtZeroCrossing = true, ExtraGridlines = new double[] { 0 } }; learningSetPlotModel.Axes.Add(xAxisLearningSet); yAxisLearningSet = new LinearAxis { IsZoomEnabled = false, IsPanEnabled = false, Position = AxisPosition.Left, Minimum = -13, Maximum = 13, PositionAtZeroCrossing = true, ExtraGridlines = new double[] { 0 } }; learningSetPlotModel.Axes.Add(yAxisLearningSet); learningSetPlotModel.PlotMargins = new OxyPlot.OxyThickness(0); learningSetPlot.LayoutUpdated += learningSetPlotLayoutUpdated; learningSetPlot.Model = learningSetPlotModel; originalButtonBackgroundColor = generateLearningSetButton.Background; }
//Take a data set //calculate standard deviation, draw downs, annual return, sharpe, sortino, Jensen's alpha //Test correlation between different time series public ScatterSeries CorrelateWithNextDay() { ScatterSeries ss = new ScatterSeries() { MarkerSize = .8, MarkerStroke = OxyColors.Blue, MarkerFill = OxyColors.Blue }; bool axis1Direction = this.domain[1] - this.domain[0] > 0; int i = this.Count() - 1; List <IDataPoint> newPoints = new List <IDataPoint>(); while (i >= 1) { newPoints.Add(new DataPoint(this.range[i], this.range[--i])); } ss.Points = newPoints; return(ss); }
public static PlotView Chart1(string _tytul, double[,] data) { var plot = new PlotView { Dock = DockStyle.Fill, Size = new Size(500, 500) }; var model = new PlotModel { Title = _tytul }; var scatterSeries = new ScatterSeries() { MarkerType = MarkerType.Circle, MarkerSize = 0.01, MarkerFill = OxyColors.Aqua }; for (var i = 0; i < Program.TestDane.Length / 2; i++) { var x = Program.TestDane[0, i]; var y = Program.TestDane[1, i]; scatterSeries.Points.Add(new ScatterPoint(x, y, 2)); } var lineSeries = new LineSeries() { }; for (var i = 0; i < data.Length / 2; i++) { lineSeries.Points.Add(new DataPoint(data[0, i], data[1, i])); } model.Axes.Add(new LinearAxis { Position = AxisPosition.Bottom, Minimum = -5, Maximum = 5 }); model.Axes.Add(new LinearAxis { Position = AxisPosition.Left, Minimum = -8, Maximum = 5 }); model.Series.Add(scatterSeries); model.Series.Add(lineSeries); plot.Model = model; plot.InvalidatePlot(true); model.InvalidatePlot(true); return(plot); }
private void button2_Click(object sender, EventArgs e) { PlotView pv = new PlotView(); pv.Location = new Point(0, 0); pv.Size = new Size(550, 500); this.Controls.Add(pv); pv.Model = new PlotModel { Title = "Perceptron's separation line" }; FunctionSeries fs = new FunctionSeries(); for (int i = 0; i < 2; i++) { fs.Points.Add(new OxyPlot.DataPoint(tab[i, 0], tab[i, 1])); } pv.Model.Series.Add(fs); ScatterSeries sc1 = new ScatterSeries { Title = "1", MarkerStroke = OxyColor.FromRgb(255, 1, 0), MarkerType = MarkerType.Plus }; ScatterSeries sc2 = new ScatterSeries { Title = "1", MarkerStroke = OxyColor.FromRgb(255, 1, 0), MarkerType = MarkerType.Plus }; ScatterSeries sc3 = new ScatterSeries { Title = "0", MarkerStroke = OxyColor.FromRgb(0, 1, 0), MarkerType = MarkerType.Plus }; ScatterSeries sc4 = new ScatterSeries { Title = "0", MarkerStroke = OxyColor.FromRgb(0, 1, 0), MarkerType = MarkerType.Plus }; sc1.Points.Add(new ScatterPoint(inputSamples[0, 0], inputSamples[0, 1])); sc2.Points.Add(new ScatterPoint(inputSamples[1, 0], inputSamples[1, 1])); sc3.Points.Add(new ScatterPoint(inputSamples[2, 0], inputSamples[2, 1])); sc4.Points.Add(new ScatterPoint(inputSamples[3, 0], inputSamples[3, 1])); pv.Model.Series.Add(sc1); pv.Model.Series.Add(sc2); pv.Model.Series.Add(sc3); pv.Model.Series.Add(sc4); }
public ChartController() { FirstChart = new ChartRepresentation { SelectedIndex = -1, SignalRepresentation = new SignalRepresentation(), SignalProperties = new SignalTextProperties(), PlotColor = OxyColors.Blue, RealSeries = new ScatterSeries(), ImaginarySeries = new ScatterSeries() }; SecondChart = new ChartRepresentation { SelectedIndex = -1, SignalRepresentation = new SignalRepresentation(), SignalProperties = new SignalTextProperties(), PlotColor = OxyColors.Red, RealSeries = new ScatterSeries(), ImaginarySeries = new ScatterSeries() }; NumberOfIntervals = 5; combinedSignal = new SignalRepresentation { Signal = new SignalImplementation() }; combinedSignal.Signal.Points = new List <Tuple <double, Complex> >(); CombinedTextProperties = new SignalTextProperties(); realCombinedSeries = new ScatterSeries(); imaginaryCombinedSeries = new ScatterSeries(); realHistogramSeries = new ColumnSeries(); realPlotModel = new PlotModel(); imaginaryPlotModel = new PlotModel(); realHistogramPlotModel = new PlotModel(); RealPlotModel.Series.Add(FirstChart.RealSeries); RealPlotModel.Series.Add(SecondChart.RealSeries); ImaginaryPlotModel.Series.Add(FirstChart.ImaginarySeries); ImaginaryPlotModel.Series.Add(SecondChart.ImaginarySeries); realHistogramPlotModel.Series.Add(realHistogramSeries); }
public void SetupPlot() { //Create an x-axis and a y-axis for the plot LinearAxis x_axis = new LinearAxis() { Position = AxisPosition.Bottom, Minimum = 0, MinimumRange = 10, MaximumRange = 1000 }; LinearAxis y_axis = new LinearAxis() { Position = AxisPosition.Left, Minimum = 0, MinimumRange = 10, Maximum = double.NaN, MaximumRange = double.NaN }; //Clear all annotations _session_plot_model.Annotations.Clear(); //Clear the set of axes on the plot and add the axes we just created _session_plot_model.Axes.Clear(); _session_plot_model.Axes.Add(x_axis); _session_plot_model.Axes.Add(y_axis); //Clear all the series on this plot _session_plot_model.Series.Clear(); //Add a scatter series to the plot var scatter_series = new ScatterSeries() { MarkerType = MarkerType.Triangle, MarkerStroke = OxyColor.FromRgb(0, 0, 255), MarkerFill = OxyColor.FromRgb(128, 128, 255) }; //Add the series to the plot _session_plot_model.Series.Add(scatter_series); //Update the plot _session_plot_model.InvalidatePlot(true); }
protected void PintarTabulador(bool pFgSeleccionados) { var vEmpleadosSeleccionados = vLstEmpleadosSeleccionados.Select(s => s.ID_EMPLEADO).ToList(); vEmpleados = vEmpTabuladores.Where(w => vEmpleadosSeleccionados.Contains(w.ID_EMPLEADO)).ToList(); if (vEmpleados != null) { ScatterChartGraficaAnalisis.PlotArea.Series.Clear(); foreach (var iTab in vSeleccionadosTabuladores) { ScatterSeries vPrimerScatterSeries = new ScatterSeries(); DataTable dt = new DataTable(); dt.Columns.Add("xValues", typeof(double)); dt.Columns.Add("yValues", typeof(double)); //int vComienza = int.Parse(rnComienza.Text); //int vTermina = int.Parse(rnTermina.Text); foreach (var iEmp in vEmpleados) { if (iTab.ID_SELECCIONADO == iEmp.ID_TABULADOR) { //if (iEmp.NO_NIVEL >= vComienza && iEmp.NO_NIVEL <= vTermina) //{ vPrimerScatterSeries.SeriesItems.Add(iEmp.NO_NIVEL, iEmp.MN_SUELDO_ORIGINAL); vPrimerScatterSeries.LabelsAppearance.Visible = false; vPrimerScatterSeries.Name = "Sueldos" + " " + iEmp.CL_TABULADOR.ToString(); vPrimerScatterSeries.TooltipsAppearance.DataFormatString = "{1}"; dt.Rows.Add(iEmp.NO_NIVEL, iEmp.MN_SUELDO_ORIGINAL); // } } } ScatterChartGraficaAnalisis.PlotArea.Series.Add(vPrimerScatterSeries); ScatterChartGraficaAnalisis.PlotArea.YAxis.MinValue = 0; ScatterChartGraficaAnalisis.PlotArea.YAxis.LabelsAppearance.DataFormatString = "{0:C}"; RegressionType selectedRegressionType = RegressionType.Linear; CreateRegressionModel.Plot(ScatterChartGraficaAnalisis, dt, "xValues", "yValues", selectedRegressionType); AddCuartil(iTab.ID_SELECCIONADO); } } }
private void UpdatePlotJoy(int x, int y) { //Joy.Series.Clear(); ScatterSeries scatterSeries = new ScatterSeries { MarkerType = MarkerType.Circle }; //LineSeries lineSeries = Joy.Series[0] as LineSeries; scatterSeries.Points.Add(new ScatterPoint(x, y)); Joy.Series.Add(scatterSeries); if (x >= xMax) { xMax = x; Joy.Axes[0].Minimum = xMax - 21; Joy.Axes[0].Maximum = xMax + 1; } if (x <= -xMax) { xMax = -x; Joy.Axes[0].Minimum = -xMax - 1; Joy.Axes[0].Maximum = -xMax + 21; } if (y >= yMax) { yMax = y; Joy.Axes[1].Minimum = yMax - 21; Joy.Axes[1].Maximum = yMax + 1; } if (y <= -yMax) { yMax = -y; Joy.Axes[1].Minimum = -yMax - 1; Joy.Axes[1].Maximum = -yMax + 21; } bool btnPressed = false; Joy.InvalidatePlot(true); }
public void AddInfo(List<Info> LearningSet, List<Info> TestSet) { ScatterSeries learningSetSeries = new ScatterSeries(); foreach (Info info in LearningSet) { learningSetSeries.Points.Add(new ScatterPoint(info.StartAge, info.QuitAge)); } learningSetSeries.MarkerSize = POINT_SIZE; GraphModel.Series.Add(learningSetSeries); ScatterSeries testSetSeries = new ScatterSeries(); foreach (Info info in TestSet) { testSetSeries.Points.Add(new ScatterPoint(info.StartAge, info.QuitAge)); } testSetSeries.MarkerSize = POINT_SIZE; GraphModel.Series.Add(testSetSeries); }
private PlotModel CreateScatteredChart(List <Coordinate> list) { var model = new PlotModel { Title = "" }; var scatterSeries = new ScatterSeries { MarkerType = MarkerType.Circle }; for (int i = 0; i < list.Count - 1; i++) { scatterSeries.Points.Add(new ScatterPoint(list[i].XValue, list[i].YValue, 3)); } model.Series.Add(scatterSeries); return(model); }
private void wyswietlDyskretny(Sygnal B) { ScatterSeries mySeries = new ScatterSeries(); mySeries.Title = "Baza"; mySeries.IndependentValueBinding = new Binding("Key"); mySeries.DependentValueBinding = new Binding("Value"); punkty = new List <KeyValuePair <double, double> >(); for (int i = 0; i < B.x.Count; i++) { punkty.Add(new KeyValuePair <double, double>(B.x[i].Real, B.y[i].Real)); } mySeries.ItemsSource = punkty; Baza.Series.Add(mySeries); }
public void AutomaticMinimumAndMaximum() { Chart chart = new Chart(); ScatterSeries series = new ScatterSeries(); series.IndependentValueBinding = new Binding(); series.ItemsSource = new int[] { 100 }; chart.Series.Add(series); TestAsync( chart, () => { foreach (LinearAxis axis in chart.ActualAxes) { Assert.IsTrue((99 == axis.ActualMinimum) && (axis.ActualMaximum == 101)); } }); }
public void DrawGraph(List <DateTimeValues> values, string _graphName) { scatterSeries = new ScatterSeries() { Title = _graphName, MarkerType = MarkerType.Circle, MarkerSize = 2, }; foreach (var item in values) { scatterSeries.Points.Add(new ScatterPoint(DateTimeAxis.ToDouble(item.dateTime), item.values)); } _canvas.Series.Add(scatterSeries); pv.InvalidatePlot(true); }
public void PlotData(LiveCharts.WinForms.CartesianChart chart) { // чтобы сократить время отрисовки chart.AnimationsSpeed = TimeSpan.Zero; chart.Series.Clear(); ScatterSeries scatter = new ScatterSeries(); scatter.Values = new ChartValues <ObservablePoint>(); for (int i = 0; i < X.Length; i++) { scatter.Values.Add(new ObservablePoint(X[i], Y[i])); } chart.Series.Add(scatter); }
public static PlotModel RandomSize(int n, int binsize) { var model = new PlotModel(string.Format("ScatterSeries with random MarkerSize (n={0})", n), "BinSize = " + binsize); var s1 = new ScatterSeries("Series 1") { MarkerStrokeThickness = 0, BinSize = binsize }; var random = new Random(); for (int i = 0; i < n; i++) { s1.Points.Add(new ScatterPoint(random.NextDouble(), random.NextDouble(), 4 + 10 * random.NextDouble())); } model.Series.Add(s1); return(model); }
private ScatterSeries GetNewSerie(ScatterData data) { Random countRandom = new Random(); ChartYAxisValueCollection <ChartYAxisValue> yVals = new ChartYAxisValueCollection <ChartYAxisValue>(); int count = data.XAxisCount; for (int i = 0; i < count; i++) { yVals.Add(new BarYAxisValue(countRandom.Next(0, count))); } ScatterSeries set1 = new ScatterSeries(yVals, "DataSet 1"); set1.AddColor(DemoGlobal.GetRandomColor()); set1.AddColor(DemoGlobal.GetRandomColor()); set1.AddColor(DemoGlobal.GetRandomColor()); return(set1); }
private void PlotTestSet() { TestSetPlot.Series.Clear(); var grouppedPoints = this.testPoints.GroupBy(x => x.Class).OrderBy(x => x.Key); foreach (var groupping in grouppedPoints) { ScatterSeries series = new ScatterSeries(); TrainSetPlot.Series.Add(series); series.Title = groupping.Key.ToString(); series.ItemsSource = groupping.Select(p => new OxyPlot.Series.ScatterPoint(p.X, p.Y)); } TestSetPlot.InvalidatePlot(true); }
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; }
public void DrawTideGraph(List <DateTimeValues> values) { ScatterSeries rawTide = new ScatterSeries() { MarkerType = MarkerType.Circle, MarkerSize = 2, }; foreach (var item in values) { rawTide.Points.Add(new ScatterPoint(DateTimeAxis.ToDouble(item.dateTime), item.values)); } _canvas.Series.Add(rawTide); pv.InvalidatePlot(true); }
private void plot_x_vs_y(ScatterSeries scatterSeries1, LineSeries lineSeries1) { xlabel = "xCounts"; ylabel = "yCounts"; reset_minmax(); double x = 0.0; double y = 0.0; for (int i = last_start; i <= last_end; i++) { x += this.mlog.Events[i].lastx; y += this.mlog.Events[i].lasty; update_minmax(x, x); update_minmax(y, y); scatterSeries1.Points.Add(new ScatterPoint(x, y)); lineSeries1.Points.Add(new DataPoint(x, y)); } }
public MainViewModel(List <double> ArrivalTimeList, List <int> ArrivalGroupList, int CIU, int CIM) { MModel = new PlotModel() { LegendPosition = LegendPosition.RightBottom, LegendBorder = OxyColors.Black, LegendTitle = "Legend", }; //Number of people infected int Number = ArrivalTimeList.Count(); //Series Unmask var SU = new ScatterSeries() { MarkerType = MarkerType.Diamond, MarkerStrokeThickness = 0, Title = "Number of Unmasked People Infected" }; //Series Masked var SM = new ScatterSeries() { MarkerType = MarkerType.Diamond, MarkerStrokeThickness = 0, Title = "Number of Masked People Infected" }; for (int i = 0; i < Number; i++) { if (ArrivalGroupList[i] == 0) { CIU += 1; SU.Points.Add(new ScatterPoint(ArrivalTimeList[i], CIU)); } else { CIM += 1; SM.Points.Add(new ScatterPoint(ArrivalTimeList[i], CIM)); } } MModel.Series.Add(SU); MModel.Series.Add(SM); }
private void Diagram(HashSet <HashSet <Regions> > allClusters) // построение диаграммы { cartesianChart1.AxisX.Clear(); cartesianChart1.AxisX.Add(new Axis() { Title = "X-attribute", Separator = new Separator { StrokeThickness = 1, StrokeDashArray = new System.Windows.Media.DoubleCollection(new double[] { 5 }), Stroke = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(64, 79, 86)) } }); cartesianChart1.AxisY.Clear(); cartesianChart1.AxisY.Add(new Axis() { Title = "Y-attribute", Separator = new Separator { StrokeThickness = 1.5, StrokeDashArray = new System.Windows.Media.DoubleCollection(new double[] { 4 }), Stroke = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(64, 79, 86)) } }); SeriesCollection seriesViews = new SeriesCollection(); for (int i = 0; i < allClusters.Count; i++) { ChartValues <ScatterPoint> points = new ChartValues <ScatterPoint>(); for (int j = 0; j < allClusters.ElementAt(i).Count; j++) { ScatterPoint point = new ScatterPoint(allClusters.ElementAt(i).ElementAt(j).firstAttribute, allClusters.ElementAt(i).ElementAt(j).secondAttribute); points.Add(point); } ScatterSeries series = new ScatterSeries(); series.Values = points; seriesViews.Add(series); cartesianChart1.Series = seriesViews; } }
private void SetupSineWave() { graphView.Reset(); about.Text = "This graph shows a sine wave"; var points = new ScatterSeries(); var line = new PathAnnotation(); // Draw line first so it does not draw over top of points or axis labels line.BeforeSeries = true; // Generate line graph with 2,000 points for (float x = -500; x < 500; x += 0.5f) { points.Points.Add(new PointF(x, (float)Math.Sin(x))); line.Points.Add(new PointF(x, (float)Math.Sin(x))); } graphView.Series.Add(points); graphView.Annotations.Add(line); // How much graph space each cell of the console depicts graphView.CellSize = new PointF(0.1f, 0.1f); // leave space for axis labels graphView.MarginBottom = 2; graphView.MarginLeft = 3; // One axis tick/label per graphView.AxisX.Increment = 0.5f; graphView.AxisX.ShowLabelsEvery = 2; graphView.AxisX.Text = "X →"; graphView.AxisX.LabelGetter = (v) => v.Value.ToString("N2"); graphView.AxisY.Increment = 0.2f; graphView.AxisY.ShowLabelsEvery = 2; graphView.AxisY.Text = "↑Y"; graphView.AxisY.LabelGetter = (v) => v.Value.ToString("N2"); graphView.ScrollOffset = new PointF(-2.5f, -1); graphView.SetNeedsDisplay(); }
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; }
public static Example MouseHandlingExample() { var model = new PlotModel { Title = "Mouse handling example" }; var series = new ScatterSeries(); model.Series.Add(series); // Create a command that adds points to the scatter series var command = new DelegatePlotCommand<OxyMouseEventArgs>( (v, c, a) => { var point = series.InverseTransform(a.Position); series.Points.Add(new ScatterPoint(point.X, point.Y)); model.InvalidatePlot(true); }); var controller = new PlotController(); controller.BindMouseDown(OxyMouseButton.Left, command); return new Example(model, controller); }
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; }
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; }
private static ScatterSeries CreateRandomScatterSeries(Random r, 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 = r.NextDouble() * 10; double y = r.NextDouble() * 10; var p = new ScatterPoint(x, y); s1.Points.Add(p); } return s1; }
private void AddData(string flightID, int counter) { Series serie = this.chartT6L.Series[counter % 4]; if (serie != null && serie is ScatterSeries) { ScatterSeries serie1 = serie as ScatterSeries; serie1.ItemsSource = m_model.ItemsMap[flightID].T6LViewModel; serie1.Title = flightID; serie1.MarkerBrush = AircraftDataAnalysisGlobalPallete.Brushes[counter % 10]; serie1.MarkerType = PalleteMarkerTypes.MarkerTypes[counter % 10]; } else { ScatterSeries serieT6L = new ScatterSeries() { XAxis = numericXAxis1, YAxis = numericYAxis1, XMemberPath = "XValue", YMemberPath = "YValue" }; serieT6L.MarkerBrush = AircraftDataAnalysisGlobalPallete.Brushes[counter % 4]; serieT6L.MarkerType = PalleteMarkerTypes.MarkerTypes[counter % 4]; serieT6L.DataContext = m_model.ItemsMap[flightID]; serieT6L.ItemsSource = m_model.ItemsMap[flightID].T6LViewModel; this.chartT6L.Series.Add(serieT6L); } serie = this.chartT6R.Series[counter % 4]; if (serie != null && serie is ScatterSeries) { ScatterSeries serie2 = serie as ScatterSeries; serie2.ItemsSource = m_model.ItemsMap[flightID].T6LViewModel; serie2.MarkerBrush = AircraftDataAnalysisGlobalPallete.Brushes[(counter % 4) + 4]; serie2.MarkerType = PalleteMarkerTypes.MarkerTypes[(counter % 4) + 4]; } else { ScatterSeries serieT6R = new ScatterSeries() { XAxis = numericXAxis2, YAxis = numericYAxis2, XMemberPath = "XValue", YMemberPath = "YValue" }; serieT6R.MarkerBrush = AircraftDataAnalysisGlobalPallete.Brushes[(counter % 4) + 4]; serieT6R.MarkerType = PalleteMarkerTypes.MarkerTypes[(counter % 4) + 4]; serieT6R.ItemsSource = m_model.ItemsMap[flightID].T6RViewModel; this.chartT6R.Series.Add(serieT6R); } }
public static PlotModel ScatterSeries() { var plotModel1 = new PlotModel { Title = "Scatterseries not rendered at specific plot sizes", PlotMargins = new OxyThickness(50, 5, 5, 50), Padding = new OxyThickness(0), PlotAreaBorderThickness = new OxyThickness(1, 1, 1, 1), PlotAreaBorderColor = OxyColors.Black, TextColor = OxyColors.Black, LegendOrientation = LegendOrientation.Horizontal, LegendPosition = LegendPosition.TopRight, LegendMargin = 0 }; plotModel1.Axes.Add(new LinearAxis { IsAxisVisible = true, Title = "X", Position = AxisPosition.Bottom, TickStyle = TickStyle.Outside, TicklineColor = OxyColors.Black, Minimum = 0, MaximumPadding = 0.05 }); plotModel1.Axes.Add(new LogarithmicAxis { MinimumPadding = 0.05, MaximumPadding = 0.1, Title = "Y", Position = AxisPosition.Left, TickStyle = TickStyle.Outside, TicklineColor = OxyColors.Black, MajorGridlineColor = OxyColors.Black, MajorGridlineStyle = LineStyle.Solid }); var referenceCurve = new LineSeries { Title = "Reference", Smooth = true, Color = OxyColor.FromArgb(255, 89, 128, 168) }; var upperBoundary = new LineSeries { LineStyle = LineStyle.Dot, Color = OxyColors.LightGray, Smooth = true, Title = string.Empty }; var lowerBoundary = new LineSeries { LineStyle = LineStyle.Dot, Color = OxyColors.LightGray, Smooth = true, Title = "+/- 15 %" }; // Series that holds and formats points inside of the boundary var inBoundaryResultLine = new ScatterSeries { Title = "actual", MarkerFill = OxyColors.Black, MarkerSize = 4, MarkerStroke = OxyColors.White, MarkerType = MarkerType.Circle }; // Series that holds and formats points outside of the boundary var outBoundaryResultLine = new ScatterSeries { Title = "not permissible deviation", MarkerFill = OxyColors.Red, MarkerSize = 4, MarkerStroke = OxyColors.White, MarkerType = MarkerType.Circle }; // Just some random data to fill the series: var referenceValues = new[] { double.NaN, 0.985567558024852, 0.731704530257957, 0.591109071735532, 0.503627816316065, 0.444980686815776, 0.403576666032678, 0.373234299823915, 0.350375591667333, 0.332795027566349, 0.319063666439909, 0.30821748743148, 0.299583943726489, 0.292680371378706, 0.287151885046283, 0.282732008216725, 0.279216923371711, 0.276557880999918 }; var actualValues = new[] { double.NaN, 0.33378346040897, 1.09868427497967, 0.970771068054048, 0.739778217457323, 0.582112938330166, 0.456962500853806, 0.37488740614826, 0.330272509496142, 0.334461549522006, 0.30989175806678, 0.286944862053553, 0.255895385950234, 0.231850970296068, 0.217579897050944, 0.217113227224437, 0.164759946945322, 0.0459134254747994 }; for (var index = 0; index <= 17; index++) { var referenceValue = referenceValues[index]; var lowerBound = referenceValue - (referenceValue * 0.15); var upperBound = referenceValue + (referenceValue * 0.15); referenceCurve.Points.Add(new DataPoint(index, referenceValue)); lowerBoundary.Points.Add(new DataPoint(index, lowerBound)); upperBoundary.Points.Add(new DataPoint(index, upperBound)); var actualValue = actualValues[index]; if (actualValue > lowerBound && actualValue < upperBound) { inBoundaryResultLine.Points.Add(new ScatterPoint(index, actualValue)); } else { outBoundaryResultLine.Points.Add(new ScatterPoint(index, actualValue)); } } plotModel1.Series.Add(referenceCurve); plotModel1.Series.Add(lowerBoundary); plotModel1.Series.Add(upperBoundary); plotModel1.Series.Add(outBoundaryResultLine); plotModel1.Series.Add(inBoundaryResultLine); return plotModel1; }
public static PlotModel ScatterSeriesAndLinearColorAxis() { var plotModel = new PlotModel { Title = "ScatterSeries and LinearColorAxis on the same plot" }; int npoints = 100; var random = new Random(); var scatterSeries = new ScatterSeries { ColorAxisKey = string.Empty }; for (var i = 0; i < npoints; i++) { scatterSeries.Points.Add(new ScatterPoint((double)i / npoints, random.NextDouble())); } plotModel.Series.Add(scatterSeries); var lineSeries = new LineSeries(); for (var i = 0; i < npoints; i++) { lineSeries.Points.Add(new DataPoint((double)i / npoints, random.NextDouble())); } plotModel.Series.Add(lineSeries); plotModel.Axes.Add(new LinearColorAxis()); return plotModel; }
public static PlotModel MouseDownEventHitTestResult() { var model = new PlotModel { Title = "MouseDown HitTestResult", Subtitle = "Reports the index of the nearest point." }; var s1 = new LineSeries(); s1.Points.Add(new DataPoint(0, 10)); s1.Points.Add(new DataPoint(10, 40)); s1.Points.Add(new DataPoint(40, 20)); s1.Points.Add(new DataPoint(60, 30)); model.Series.Add(s1); s1.MouseDown += (s, e) => { model.Subtitle = "Index of nearest point in LineSeries: " + Math.Round(e.HitTestResult.Index); model.InvalidatePlot(false); }; var s2 = new ScatterSeries(); s2.Points.Add(new ScatterPoint(0, 15)); s2.Points.Add(new ScatterPoint(10, 45)); s2.Points.Add(new ScatterPoint(40, 25)); s2.Points.Add(new ScatterPoint(60, 35)); model.Series.Add(s2); s2.MouseDown += (s, e) => { model.Subtitle = "Index of nearest point in ScatterSeries: " + (int)e.HitTestResult.Index; model.InvalidatePlot(false); }; return model; }
private static ScatterSeries CreateRandomScatterSeries(int n, MarkerType markerType, bool setSize, bool setValue, LinearColorAxis colorAxis) { var s1 = new ScatterSeries { MarkerType = markerType, MarkerSize = 6, ColorAxisKey = colorAxis != null ? colorAxis.Key : null }; var random = new Random(13); for (int i = 0; i < n; i++) { var p = new ScatterPoint((random.NextDouble() * 2.2) - 1.1, random.NextDouble()); if (setSize) { p.Size = (random.NextDouble() * 5) + 5; } if (setValue) { p.Value = (random.NextDouble() * 2.2) - 1.1; } s1.Points.Add(p); } return s1; }
public void ScatterSeries() { var s1 = new OxyPlot.Series.ScatterSeries(); var s2 = new ScatterSeries(); OxyAssert.PropertiesAreEqual(s1, s2); }
public void TestSimpleCreation() { var random = new Random(); var points = new List<int> {100, 1000, 10000, 100000}; foreach (var totalPoints in points) { var start = DateTime.Now; var plotModel1 = new PlotModel {Subtitle = "No 'binning'", Title = "ScatterSeries (n=32768)"}; var linearAxis1 = new LinearAxis {Position = AxisPosition.Bottom}; plotModel1.Axes.Add(linearAxis1); var linearAxis2 = new LinearAxis(); plotModel1.Axes.Add(linearAxis2); var scatterSeries1 = new ScatterSeries { MarkerSize = 1, MarkerStrokeThickness = 0, MarkerType = MarkerType.Diamond, Title = "Series 1" + totalPoints }; var pointList = new List<ScatterPoint>(); for (var i = 0; i < totalPoints; i++) { var point = new ScatterPoint { X = random.NextDouble(), Y = random.NextDouble() }; pointList.Add(point); } Console.WriteLine(); var end = DateTime.Now; Console.WriteLine("Creation Part of Test Took: {0:.00} seconds for {1} points", end.Subtract(start).TotalSeconds, totalPoints); start = DateTime.Now; scatterSeries1.Points.AddRange(pointList); plotModel1.Series.Add(scatterSeries1); end = DateTime.Now; Console.WriteLine("Scatter Plot Part of Test Took: {0:.00} seconds for {1} points", end.Subtract(start).TotalSeconds, totalPoints); start = DateTime.Now; var svg = new SvgExporter(); var svgString = svg.ExportToString(plotModel1); var xml = new XmlDocument(); xml.LoadXml(svgString); var x = SvgDocument.Open(xml); // Svg.SvgDocument(); var bmp = x.Draw(); var outputFilePath = GetPath(@"testResults\ScatterPlot\testScatter" + totalPoints + ".jpg"); bmp.Save(outputFilePath); end = DateTime.Now; Console.WriteLine("Saving Part of Test Took: {0:.00} seconds for {1} points", end.Subtract(start).TotalSeconds, totalPoints); } }
public static PlotModel TrackerFormatString() { var model = new PlotModel { Title = "TrackerFormatString" }; var s1 = new ScatterSeries { TrackerFormatString = "{Sum:0.0}", DataFieldX = "X", DataFieldY = "Y" }; var myPoints = new List<MyPoint> { new MyPoint { X = 10, Y = 40 }, new MyPoint { X = 40, Y = 20 }, new MyPoint { X = 60, Y = 30 } }; s1.ItemsSource = myPoints; model.Series.Add(s1); return model; }
public static PlotModel DataPoints() { var model = new PlotModel { Title = "ScatterSeries (n=1000)", Subtitle = "The scatter points are added to the Points collection." }; var series = new ScatterSeries(); series.Points.AddRange(CreateRandomScatterPoints(1000)); model.Series.Add(series); return model; }
public static PlotModel RandomWithFit() { const int n = 20; var model = new PlotModel { Title = string.Format("Random data (n={0})", n), LegendPosition = LegendPosition.LeftTop }; var s1 = new ScatterSeries { Title = "Measurements" }; var random = new Random(7); 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; }
public static PlotModel RandomSize(int n, int binsize) { var model = new PlotModel { Title = string.Format("ScatterSeries with random MarkerSize (n={0})", n), Subtitle = "BinSize = " + binsize }; var s1 = new ScatterSeries { Title = "Series 1", MarkerStrokeThickness = 0, BinSize = binsize }; var random = new Random(13); for (int i = 0; i < n; i++) { s1.Points.Add(new ScatterPoint(random.NextDouble(), random.NextDouble(), 4 + (10 * random.NextDouble()))); } model.Series.Add(s1); return model; }
private static PlotModel RandomScatter(int n, int binSize) { var model = new PlotModel { Title = string.Format("ScatterSeries (n={0})", n), Subtitle = binSize > 0 ? "BinSize = " + binSize : "No 'binning'" }; var s1 = new ScatterSeries() { Title = "Series 1", MarkerType = MarkerType.Diamond, MarkerStrokeThickness = 0, BinSize = binSize }; var random = new Random(1); for (int i = 0; i < n; i++) { s1.Points.Add(new ScatterPoint(random.NextDouble(), random.NextDouble())); } model.Series.Add(s1); return model; }
private static ScatterSeries CreateRandomScatterSeries2(int n, string title, MarkerType markerType) { var series = new ScatterSeries { Title = title, MarkerType = markerType, MarkerStroke = OxyColors.Black, MarkerStrokeThickness = 1.0, }; series.Points.AddRange(CreateRandomScatterPoints(n)); return series; }