Ejemplo n.º 1
0
        private void MoveCurveLines(MouseEventArgs e, bool moving)
        {
            bool   timed     = false;
            string timeLabel = string.Empty;

            foreach (var view in this.ChartContainer.Children)
            {
                CurveView curveView = (CurveView)view;

                if (moving)
                {
                    Point  point   = e.GetPosition((UIElement)curveView.View);
                    double x       = point.X;
                    double centerX = curveView.CenterX;
                    if (!timed && x >= 0)
                    {
                        double v = (x - centerX) / scale + centerX;

                        double index = v / Graduation / 5;
                        timeLabel = this.GetFormatDateTime(this.currentBaseTime, (int)index, this.Interval);
                    }

                    curveView.MoveCurveLine(point, timeLabel);
                }
                else
                {
                    curveView.MoveCurveLine(false);
                }
            }
        }
Ejemplo n.º 2
0
        public CurveView AddCurveView(string curveViewName, string displayName, double height = 200.0)
        {
            CurveView curveView = new CurveView(this);

            curveView.CurveViewName = curveViewName;
            curveView.TimeScale     = this.TimeScale;
            curveView.Height        = height + ChartView.ViewGap;
            this.ChartContainer.Children.Add(curveView);
            this.AddCurveViewCheckItem(curveViewName, displayName);
            return(curveView);
        }
Ejemplo n.º 3
0
        private void ZoomChartView(double scale)
        {
            double centerX = 0.0;

            foreach (var view in this.ChartContainer.Children)
            {
                CurveView curveView = (CurveView)view;
                curveView.UpdateCurveScale(scale);
                centerX = curveView.CenterX;
            }
            this.UpdateTimeAxisScale(scale, centerX);
        }
Ejemplo n.º 4
0
 private void OnItemChecked(string curveViewName, bool itemChecked)
 {
     foreach (var cv in this.ChartContainer.Children)
     {
         CurveView curveView = (CurveView)cv;
         if (curveView.CurveViewName == curveViewName)
         {
             curveView.Visibility = itemChecked ? Visibility.Visible : Visibility.Collapsed;
             break;
         }
     }
 }
Ejemplo n.º 5
0
        private void Window_Loaded_1(object sender, RoutedEventArgs e)
        {
            this.view1 = ChartView.AddCurveView("a", "A");
            this.view1.Max = 150;
            this.view1.Min = 0;
            c1 = this.view1.CreateDataContext("a", "Hello");
            //view1.Height = 200;
            this.view2 = ChartView.AddCurveView("b", "B");
            //this.view2.Background = new SolidColorBrush(Colors.Green);
            c2 = this.view2.CreateDataContext("a", "World");

            //view2.Height = 200;
            DispatcherTimer timer = new DispatcherTimer();
            timer.Interval = TimeSpan.FromSeconds(1);
            timer.Tick += new EventHandler(AnimatedPlot);
            timer.IsEnabled = true;

            cpuPerformance.CategoryName = "Processor";
            cpuPerformance.CounterName = "% Processor Time";
            cpuPerformance.InstanceName = "_Total";
        }
Ejemplo n.º 6
0
        private void Window_Loaded_1(object sender, RoutedEventArgs e)
        {
            this.view1     = ChartView.AddCurveView("a", "A");
            this.view1.Max = 150;
            this.view1.Min = 0;
            c1             = this.view1.CreateDataContext("a", "Hello");
            //view1.Height = 200;
            this.view2 = ChartView.AddCurveView("b", "B");
            //this.view2.Background = new SolidColorBrush(Colors.Green);
            c2 = this.view2.CreateDataContext("a", "World");

            //view2.Height = 200;
            DispatcherTimer timer = new DispatcherTimer();

            timer.Interval  = TimeSpan.FromSeconds(1);
            timer.Tick     += new EventHandler(AnimatedPlot);
            timer.IsEnabled = true;

            cpuPerformance.CategoryName = "Processor";
            cpuPerformance.CounterName  = "% Processor Time";
            cpuPerformance.InstanceName = "_Total";
        }
Ejemplo n.º 7
0
        private void TrackTimeLine(MouseEventArgs e, bool calculation)
        {
            if (this.disableTracking)
            {
                return;
            }

            string    timeLabel = string.Empty;
            CurveView curveView = (CurveView)this.CurveView;

            Point  point = e.GetPosition((UIElement)curveView.CanvasView);
            double x     = point.X;

            // 暂时屏蔽TrackingLine功能
            if (false && calculation && x >= 0)
            {
                double index = x * this.currentGraduationCount / this.currentGraduation;
                timeLabel = this.GetFormatDateTime(this.currentBaseTime, (int)index, this.Interval);
            }

            curveView.TrackTimeLine(point, timeLabel, calculation);
        }
Ejemplo n.º 8
0
 public CurveView AddCurveView(string curveViewName, string displayName, double height = 200.0)
 {
     CurveView curveView = new CurveView(this);
     curveView.CurveViewName = curveViewName;
     curveView.TimeScale = this.TimeScale;
     curveView.Height = height + ChartView.ViewGap;
     this.ChartContainer.Children.Add(curveView);
     this.AddCurveViewCheckItem(curveViewName, displayName);
     return curveView;
 }