Beispiel #1
0
        //redraw scale command
        public void ReDrawScaleCmd()
        {
            YAxisCtl yaxisctl = this.FindName("yaxis") as YAxisCtl;

            BasicWaveChartUC wavechartuc  = this.FindName("ControlContainer") as BasicWaveChartUC;
            Canvas           windowcanvas = wavechartuc.FindName("WindowCanvas") as Canvas;
            Polyline         xaxis_ply    = wavechartuc.FindName("xaxis_ply") as Polyline;

            xaxis_ply.Points.Clear();
            double hlinevalue = this.Height - topblank;

            if (this.XScaleLineNumber == 0)
            {
                return;
            }
            int scalenumber = (int)(wavechartuc.NumberOfDValue / this.XScaleLineNumber);

            for (int i = 0; i <= scalenumber; i++)
            {
                xaxis_ply.Points.Add(new Point(i * XScaleLineNumber * granulity_width, hlinevalue));
                if (i % this.XCommentNumber == 0)
                {
                    xaxis_ply.Points.Add(new Point(i * XScaleLineNumber * granulity_width, hlinevalue - bigScaleHeight));
                }
                else
                {
                    xaxis_ply.Points.Add(new Point(i * XScaleLineNumber * granulity_width, hlinevalue - littleScaleHeight));
                }
                xaxis_ply.Points.Add(new Point(i * XScaleLineNumber * granulity_width, hlinevalue));
            }

            xaxis_ply.Points.Add(new Point(wavechartuc.NumberOfDValue * granulity_width, hlinevalue));      //todo replace
            xaxis_ply.Points.Add(new Point(wavechartuc.NumberOfDValue * granulity_width, hlinevalue - 20)); //todo replace
            xaxis_ply.Points.Add(new Point(wavechartuc.NumberOfDValue * granulity_width, hlinevalue));      //todo replace

            switch (this.XArrowStyle)
            {
            case ArrowStyleEnm.SOLID:
            case ArrowStyleEnm.HOLLOW:
            {
                xaxis_ply.Points.Add(new Point(this.Width - wavechartuc.RightBlankZone - this.arrowheight, hlinevalue));
                xaxis_ply.Points.Add(new Point(this.Width - wavechartuc.RightBlankZone - this.arrowheight, hlinevalue - this.arrowheight / 2));
                xaxis_ply.Points.Add(new Point(this.Width - wavechartuc.RightBlankZone - this.arrowheight, hlinevalue + this.arrowheight / 2));
                xaxis_ply.Points.Add(new Point(this.Width - wavechartuc.RightBlankZone, hlinevalue));
                xaxis_ply.Points.Add(new Point(this.Width - wavechartuc.RightBlankZone - this.arrowheight, hlinevalue - this.arrowheight / 2));
                //pf.IsFilled = true;
                break;
            }

            case ArrowStyleEnm.NONE:
            default:
            {
                xaxis_ply.Points.Add(new Point(this.Width - wavechartuc.RightBlankZone, hlinevalue));
                break;
            }
            }
        }
Beispiel #2
0
 //self event
 private void self_Loaded(object sender, RoutedEventArgs e)
 {
     parent     = this.FindName("ControlContainer") as BasicWaveChartUC;
     xaxis      = this.FindName("xaxis") as XAxisCtl;
     yaxis      = this.FindName("yaxis") as YAxisCtl;
     moveslider = this.FindName("moveslider") as Slider;
     wincanvas  = this.FindName("WindowCanvas") as Canvas;
     ;
 }
Beispiel #3
0
        private static void YScaleMaxValue_Changed(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            YAxisCtl         self        = d as YAxisCtl;
            XAxisCtl         xaxisctl    = self.FindName("xaxis") as XAxisCtl;
            BasicWaveChartUC wavechartuc = self.FindName("ControlContainer") as BasicWaveChartUC;

            if (xaxisctl == null || wavechartuc == null)
            {
                return;
            }

            self.granulity_width = (self.Height - xaxisctl.Height - self.arrowheight - wavechartuc.TopBlankZone) / self.YScaleMaxValue;
        }
Beispiel #4
0
        //redraw text command
        public void ReDrawTextCommentCmd()
        {
            Canvas           xaxis_text_canvas = this.FindName("xaxis_text_canvas") as Canvas;
            BasicWaveChartUC wavechartuc       = this.FindName("ControlContainer") as BasicWaveChartUC;
            XAxisCtl         xaxis             = this.FindName("xaxis") as XAxisCtl;
            YAxisCtl         yaxis             = this.FindName("yaxis") as YAxisCtl;

            //add the scale text
            xaxis_text_canvas.Children.Clear();

            //0
            xaxis_text_canvas.Children.Add(new TextBlock());
            (xaxis_text_canvas.Children[xaxis_text_canvas.Children.Count - 1] as TextBlock).Text     = "0";
            (xaxis_text_canvas.Children[xaxis_text_canvas.Children.Count - 1] as TextBlock).FontSize = 8;
            Canvas.SetLeft((xaxis_text_canvas.Children[xaxis_text_canvas.Children.Count - 1] as TextBlock), 0);
            Canvas.SetBottom((xaxis_text_canvas.Children[xaxis_text_canvas.Children.Count - 1] as TextBlock), 0);
            if (xaxis.XScaleLineNumber == 0)
            {
                return;
            }
            int loop = (int)(wavechartuc.NumberOfDValue / xaxis.XScaleLineNumber / xaxis.XCommentNumber);

            for (int i = 1; i < loop; i++)
            {
                xaxis_text_canvas.Children.Add(new TextBlock());
                (xaxis_text_canvas.Children[xaxis_text_canvas.Children.Count - 1] as TextBlock).Text =
                    (i * xaxis.XScaleLineNumber * xaxis.XCommentNumber).ToString();
                (xaxis_text_canvas.Children[xaxis_text_canvas.Children.Count - 1] as TextBlock).FontSize = 8;
                Canvas.SetLeft((xaxis_text_canvas.Children[xaxis_text_canvas.Children.Count - 1] as TextBlock), (i * xaxis.XScaleLineNumber * xaxis.XCommentNumber) * xaxis.GetGranulity());
                Canvas.SetBottom((xaxis_text_canvas.Children[xaxis_text_canvas.Children.Count - 1] as TextBlock), 0);
            }

            //the text of last big scale
            xaxis_text_canvas.Children.Add(new TextBlock());
            (xaxis_text_canvas.Children[xaxis_text_canvas.Children.Count - 1] as TextBlock).Text =
                (loop * xaxis.XScaleLineNumber * xaxis.XCommentNumber).ToString();
            (xaxis_text_canvas.Children[xaxis_text_canvas.Children.Count - 1] as TextBlock).FontSize = 8;
            Canvas.SetLeft((xaxis_text_canvas.Children[xaxis_text_canvas.Children.Count - 1] as TextBlock), (loop * xaxis.XScaleLineNumber * xaxis.XCommentNumber) * xaxis.GetGranulity());
            Canvas.SetBottom((xaxis_text_canvas.Children[xaxis_text_canvas.Children.Count - 1] as TextBlock), 0);

            //the max of dvalue
            xaxis_text_canvas.Children.Add(new TextBlock());
            (xaxis_text_canvas.Children[xaxis_text_canvas.Children.Count - 1] as TextBlock).Text =
                wavechartuc.NumberOfDValue.ToString();  //todo replace 1187
            (xaxis_text_canvas.Children[xaxis_text_canvas.Children.Count - 1] as TextBlock).FontSize = 8;
            Canvas.SetLeft((xaxis_text_canvas.Children[xaxis_text_canvas.Children.Count - 1] as TextBlock), wavechartuc.NumberOfDValue * xaxis.GetGranulity());
            Canvas.SetBottom((xaxis_text_canvas.Children[xaxis_text_canvas.Children.Count - 1] as TextBlock), 0);
        }
Beispiel #5
0
        //redraw command
        public void ReDrawCmd()
        {
            Canvas   yaxis_text_canvas = this.FindName("yaxis_text_canvas") as Canvas;
            YAxisCtl yaxis             = this.FindName("yaxis") as YAxisCtl;
            XAxisCtl xaxis             = this.FindName("xaxis") as XAxisCtl;

            //add the scale text
            yaxis_text_canvas.Children.Clear();
            //0
            yaxis_text_canvas.Children.Add(new TextBlock());
            (yaxis_text_canvas.Children[yaxis_text_canvas.Children.Count - 1] as TextBlock).Text     = "0";
            (yaxis_text_canvas.Children[yaxis_text_canvas.Children.Count - 1] as TextBlock).FontSize = 8;
            Canvas.SetLeft((yaxis_text_canvas.Children[yaxis_text_canvas.Children.Count - 1] as TextBlock), 0);
            Canvas.SetBottom((yaxis_text_canvas.Children[yaxis_text_canvas.Children.Count - 1] as TextBlock), xaxis.Height);
            int loop = (int)(yaxis.YScaleMaxValue / yaxis.YScaleLineNumber / yaxis.YCommentNumber);

            for (int i = 1; i < loop; i++)
            {
                yaxis_text_canvas.Children.Add(new TextBlock());
                (yaxis_text_canvas.Children[yaxis_text_canvas.Children.Count - 1] as TextBlock).Text =
                    (i * yaxis.YScaleLineNumber * yaxis.YCommentNumber).ToString();
                (yaxis_text_canvas.Children[yaxis_text_canvas.Children.Count - 1] as TextBlock).FontSize = 8;
                Canvas.SetLeft((yaxis_text_canvas.Children[yaxis_text_canvas.Children.Count - 1] as TextBlock), 0);
                Canvas.SetBottom((yaxis_text_canvas.Children[yaxis_text_canvas.Children.Count - 1] as TextBlock), xaxis.Height + i * yaxis.YScaleLineNumber * yaxis.YCommentNumber * yaxis.GetGranulity());
            }

            //the text of last big scale
            yaxis_text_canvas.Children.Add(new TextBlock());
            (yaxis_text_canvas.Children[yaxis_text_canvas.Children.Count - 1] as TextBlock).Text =
                (loop * yaxis.YScaleLineNumber * yaxis.YCommentNumber).ToString();
            (yaxis_text_canvas.Children[yaxis_text_canvas.Children.Count - 1] as TextBlock).FontSize = 8;
            Canvas.SetLeft((yaxis_text_canvas.Children[yaxis_text_canvas.Children.Count - 1] as TextBlock), 0);
            Canvas.SetBottom((yaxis_text_canvas.Children[yaxis_text_canvas.Children.Count - 1] as TextBlock), xaxis.Height + loop * yaxis.YScaleLineNumber * yaxis.YCommentNumber * yaxis.GetGranulity());

            //set the max value
            yaxis_text_canvas.Children.Add(new TextBlock());
            (yaxis_text_canvas.Children[yaxis_text_canvas.Children.Count - 1] as TextBlock).Text =
                yaxis.YScaleMaxValue.ToString();
            (yaxis_text_canvas.Children[yaxis_text_canvas.Children.Count - 1] as TextBlock).FontSize = 8;
            Canvas.SetLeft((yaxis_text_canvas.Children[yaxis_text_canvas.Children.Count - 1] as TextBlock), 0);
            //Canvas.SetBottom((yaxis_text_canvas.Children[yaxis_text_canvas.Children.Count - 1] as TextBlock), xaxis.Height + yaxis.YScaleMaxValue * yaxis.GetGranulity()-20);
            Canvas.SetBottom((yaxis_text_canvas.Children[yaxis_text_canvas.Children.Count - 1] as TextBlock), xaxis.Height + yaxis.YScaleMaxValue * yaxis.GetGranulity());
        }