Exemple #1
0
        /// <summary>
        /// </summary>
        public static void DrawyAxisReverse(Canvas canvas_line, Canvas canvas_text, int min, int max,
                                            int realstep, int pixels, float span_length)
        {
            SolidColorBrush brush = new SolidColorBrush(Colors.Black);
            AxisPoint       axis  = new AxisPoint();

            axis.MinValue    = min;
            axis.MaxValue    = max;
            axis.MaxRealStep = realstep;
            axis.SpanLength  = span_length;
            axis.Length      = pixels;
            axis.GetRule();

            canvas_line.Children.Clear();
            canvas_text.Children.Clear();

            for (int i = 0; i < axis.ListPoint.Count; i++)
            {
                Line line = new Line();
                line.Stroke = brush;
                line.X1     = 0;
                line.Y1     = axis.ListPoint[i].X;
                line.X2     = 10;
                line.Y2     = axis.ListPoint[i].X;

                canvas_line.Children.Add(line);

                if (i == 0)
                {
                    if (!axis.LeftShow)
                    {
                        continue;
                    }
                }
                if (i == axis.ListPoint.Count - 1)
                {
                    if (!axis.RigthShow)
                    {
                        continue;
                    }
                }

                TextBlock tb = new TextBlock();
                tb.Width      = 70;
                tb.Foreground = brush;
                tb.Background = null;

                int temp = max - (int)axis.ListPoint[i].Y;
                tb.Text          = temp.ToString("F0") + "'";
                tb.TextAlignment = TextAlignment.Center;

                canvas_text.Children.Add(tb);
                Canvas.SetBottom(tb, axis.ListPoint[i].X);
                tb.Loaded += ytb_Loaded;
            }
        }
Exemple #2
0
        /// <summary>
        /// </summary>
        public static void DrawxAxis(Canvas canvas_line, Canvas canvas_text, float min, float max,
                                     int realstep, int pixels)
        {
            SolidColorBrush brush = new SolidColorBrush(Colors.Black);
            AxisPoint       axis  = new AxisPoint();

            axis.MinValue    = min;
            axis.MaxValue    = max;
            axis.MaxRealStep = realstep;
            axis.Length      = pixels;
            axis.GetRule();

            canvas_line.Children.Clear();
            canvas_text.Children.Clear();

            for (int i = 0; i < axis.ListPoint.Count; i++)
            {
                Line line = new Line();
                line.Stroke = brush;
                line.Y1     = 0;
                line.X1     = axis.ListPoint[i].X;
                line.Y2     = 10;
                line.X2     = axis.ListPoint[i].X;

                canvas_line.Children.Add(line);

                if (i == 0)
                {
                    if (!axis.LeftShow)
                    {
                        continue;
                    }
                }
                if (i == axis.ListPoint.Count - 1)
                {
                    if (!axis.RigthShow)
                    {
                        continue;
                    }
                }
                TextBlock tb = new TextBlock();
                tb.Width         = 40;
                tb.Foreground    = brush;
                tb.Background    = null; //new SolidColorBrush(Colors.White);
                tb.Text          = axis.ListPoint[i].Y.ToString("F1");
                tb.TextAlignment = TextAlignment.Center;
                canvas_text.Children.Add(tb);
                Canvas.SetLeft(tb, axis.ListPoint[i].X);
                tb.Loaded += xtb_Loaded;
            }
        }
Exemple #3
0
        /// <summary>
        /// </summary>
        public static void DrawyAxis(Canvas canvas_line, Canvas canvas_text, float min, float max,
                                     int realstep, int pixels, float spanlength)
        {
            SolidColorBrush brush = new SolidColorBrush(Colors.Black);
            AxisPoint       axis  = new AxisPoint {
                MinValue = min, MaxValue = max, MaxRealStep = realstep, Length = pixels, SpanLength = spanlength
            };

            axis.GetRule();

            canvas_line.Children.Clear();
            canvas_text.Children.Clear();

            for (int i = 0; i < axis.ListPoint.Count; i++)
            {
                Line line = new Line {
                    Stroke = brush, X1 = 0, Y1 = axis.ListPoint[i].X, X2 = 10, Y2 = axis.ListPoint[i].X
                };

                canvas_line.Children.Add(line);

                if (i == 0)
                {
                    if (!axis.LeftShow)
                    {
                        continue;
                    }
                }
                if (i == axis.ListPoint.Count - 1)
                {
                    if (!axis.RigthShow)
                    {
                        continue;
                    }
                }

                TextBlock tb = new TextBlock();
                tb.Width      = 40;
                tb.Foreground = brush;
                tb.Background = null; //new System.Windows.Media.SolidColorBrush(Colors.White);

                tb.Text          = axis.ListPoint[i].Y.ToString("F1");
                tb.TextAlignment = TextAlignment.Center;

                canvas_text.Children.Add(tb);
                Canvas.SetBottom(tb, axis.ListPoint[i].X);
                tb.Loaded += ytb_Loaded;
            }
        }