コード例 #1
0
        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;
        }
コード例 #2
0
        private static void OnStrokeDashArrayChanged(object target, DependencyPropertyChangedEventArgs e)
        {
            LineGraph lineGraph = (LineGraph)target;

            lineGraph.polyline.StrokeDashArray = e.NewValue as DoubleCollection;
        }
コード例 #3
0
        private static void OnStrokeChanged(object target, DependencyPropertyChangedEventArgs e)
        {
            LineGraph lineGraph = (LineGraph)target;

            lineGraph.polyline.Stroke = e.NewValue as Brush;
        }
コード例 #4
0
ファイル: MainWindow.g.cs プロジェクト: Kim-Tae-Kwan/StudyWPF
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 49 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.MenuItem_Click);

            #line default
            #line hidden
                return;

            case 2:

            #line 56 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.MenuItemStart_Click);

            #line default
            #line hidden
                return;

            case 3:

            #line 61 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.MenuItemStop_Click);

            #line default
            #line hidden
                return;

            case 4:

            #line 68 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.MenuItem_Click_1);

            #line default
            #line hidden
                return;

            case 5:
                this.ConnTime = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 6:
                this.TxtSensorCount = ((System.Windows.Controls.TextBox)(target));
                return;

            case 7:
                this.GroupBox = ((System.Windows.Controls.GroupBox)(target));
                return;

            case 8:
                this.PgbPhotoRegistor = ((System.Windows.Controls.ProgressBar)(target));
                return;

            case 9:
                this.LblPhotoRegistor = ((System.Windows.Controls.TextBox)(target));
                return;

            case 10:
                this.RtbLog = ((System.Windows.Controls.TextBox)(target));
                return;

            case 11:
                this.CboSerialPort = ((System.Windows.Controls.ComboBox)(target));

            #line 109 "..\..\MainWindow.xaml"
                this.CboSerialPort.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.CboSerialPort_SelectionChanged);

            #line default
            #line hidden
                return;

            case 12:
                this.BtnConnect = ((System.Windows.Controls.Button)(target));

            #line 113 "..\..\MainWindow.xaml"
                this.BtnConnect.Click += new System.Windows.RoutedEventHandler(this.BtnConnect_Click);

            #line default
            #line hidden
                return;

            case 13:
                this.BtnDisconnect = ((System.Windows.Controls.Button)(target));

            #line 115 "..\..\MainWindow.xaml"
                this.BtnDisconnect.Click += new System.Windows.RoutedEventHandler(this.BtnDisconnect_Click);

            #line default
            #line hidden
                return;

            case 14:
                this.BtnPortValue = ((System.Windows.Controls.Button)(target));
                return;

            case 15:
                this.linegraph = ((InteractiveDataDisplay.WPF.LineGraph)(target));
                return;
            }
            this._contentLoaded = true;
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        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);
        }