private void button_Click(object sender, RoutedEventArgs e) { int pointCount = 10_000; double[] xs = Consecutive(pointCount); double[] ys1 = RandomWalk(pointCount); double[] ys2 = RandomWalk(pointCount); // create the lines and describe their styling var line1 = new InteractiveDataDisplay.WPF.LineGraph { Stroke = new SolidColorBrush(Colors.Blue), Description = "Line A", StrokeThickness = 2 }; var line2 = new InteractiveDataDisplay.WPF.LineGraph { Stroke = new SolidColorBrush(Colors.Red), Description = "Line B", StrokeThickness = 2 }; // load data into the lines line1.Plot(xs, ys1); line2.Plot(xs, ys2); // add lines into the grid myGrid.Children.Clear(); myGrid.Children.Add(line1); myGrid.Children.Add(line2); // customize styling myChart.Title = $"Line Plot ({pointCount:n0} points each)"; myChart.BottomTitle = $"Horizontal Axis Label"; myChart.LeftTitle = $"Vertical Axis Label"; myChart.IsAutoFitEnabled = true; myChart.LegendVisibility = Visibility.Visible; }
public async void AddPointRaz(int[,] det) { // Start_time = DateTime.Now; //ClassTextFile.CreatFileData(PathText.Text + Start_time.Year.ToString() + "_" + Start_time.Month.ToString() + "_" + Start_time.Day.ToString() + "_" + Start_time.Hour.ToString() + "_" + Start_time.Minute.ToString()); await linegraph.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() => { linegraph.Children.Clear(); })); var x = new int[det.Length / 12]; // var y = x.Select(v => Math.Abs(v) < 1e-10 ? 1 : Math.Sin(v)/v).ToArray(); var y = new int[x.Length]; for (int i = 0; i < x.Length; i++) { x[i] = i; } for (int i = 0; i < 12; i++) { LineGraph lg = new InteractiveDataDisplay.WPF.LineGraph(); // lg.Stroke = new SolidColorBrush(Color.FromArgb(255, Convert.ToByte(xx), Convert.ToByte(255 -xx), Convert.ToByte(0 +xx))); switch (i) { case 1: lg.Stroke = new SolidColorBrush(Colors.Red); break; case 2: lg.Stroke = new SolidColorBrush(Colors.Green); break; case 3: lg.Stroke = new SolidColorBrush(Colors.Black); break; case 4: lg.Stroke = new SolidColorBrush(Colors.Blue); break; case 5: lg.Stroke = new SolidColorBrush(Colors.Yellow); break; case 6: lg.Stroke = new SolidColorBrush(Colors.Aqua); break; case 7: lg.Stroke = new SolidColorBrush(Colors.Thistle); break; case 8: lg.Stroke = new SolidColorBrush(Colors.AliceBlue); break; case 9: lg.Stroke = new SolidColorBrush(Colors.Aquamarine); break; case 10: lg.Stroke = new SolidColorBrush(Colors.DarkBlue); break; case 11: lg.Stroke = new SolidColorBrush(Colors.Gray); break; case 12: lg.Stroke = new SolidColorBrush(Colors.DarkGoldenrod); break; default: break; } lg.Description = String.Format("Детектор №" + (i + 1).ToString()); lg.StrokeThickness = 2; for (int j = 0; j < det.Length / 12; j++) { y[j] = det[i, j]; } lg.Plot(x, y); listY.Add(new VLine() { listX = x, listY = y }); linegraph.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() => { linegraph.Children.Add(lg); })); } //barChart.PlotBars(y); }
public async void AddPoint() { // Start_time = DateTime.Now; //ClassTextFile.CreatFileData(PathText.Text + Start_time.Year.ToString() + "_" + Start_time.Month.ToString() + "_" + Start_time.Day.ToString() + "_" + Start_time.Hour.ToString() + "_" + Start_time.Minute.ToString()); await linegraph.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() => { linegraph.Children.Clear(); })); int xx = 25; listY.ElementAt(1).listX[6] = 6; //listY.ElementAt(1).listY.Add(3); for (int i = 0; i < 12; i++) { var x = new int[listY.ElementAt(i).listX.Count()]; // var y = x.Select(v => Math.Abs(v) < 1e-10 ? 1 : Math.Sin(v)/v).ToArray(); var y = new int[listY.ElementAt(i).listX.Count()]; x = listY.ElementAt(i).listX.ToArray(); y = listY.ElementAt(i).listY.ToArray(); LineGraph lg = new InteractiveDataDisplay.WPF.LineGraph(); await linegraph.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() => { linegraph.Children.Add(lg); })); // lg.Stroke = new SolidColorBrush(Color.FromArgb(255, Convert.ToByte(xx), Convert.ToByte(255 -xx), Convert.ToByte(0 +xx))); switch (i) { case 1: lg.Stroke = new SolidColorBrush(Colors.Red); break; case 2: lg.Stroke = new SolidColorBrush(Colors.Green); break; case 3: lg.Stroke = new SolidColorBrush(Colors.Black); break; case 4: lg.Stroke = new SolidColorBrush(Colors.Blue); break; case 5: lg.Stroke = new SolidColorBrush(Colors.Yellow); break; case 6: lg.Stroke = new SolidColorBrush(Colors.Aqua); break; case 7: lg.Stroke = new SolidColorBrush(Colors.Thistle); break; case 8: lg.Stroke = new SolidColorBrush(Colors.AliceBlue); break; case 9: lg.Stroke = new SolidColorBrush(Colors.Aquamarine); break; case 10: lg.Stroke = new SolidColorBrush(Colors.DarkBlue); break; case 11: lg.Stroke = new SolidColorBrush(Colors.Gray); break; case 12: lg.Stroke = new SolidColorBrush(Colors.DarkGoldenrod); break; default: break; } xx += 25; lg.Description = String.Format("Детектор №" + i.ToString()); lg.StrokeThickness = 2; lg.Plot(x, y); // listY.Add(new VLine() { listX = x.ToList(), listY = y.ToList() }); } //barChart.PlotBars(y); }