Exemplo n.º 1
0
        public override void DrawOrMove(ChartPoint previousDrawn, ChartPoint current, int index, ChartCore chart)
        {
            if (IsNew)
            {
                Canvas.SetTop(Rectangle, Data.Top);
                Canvas.SetLeft(Rectangle, ZeroReference);

                Rectangle.Width  = 0;
                Rectangle.Height = Data.Height;

                if (DataLabel != null)
                {
                    Canvas.SetTop(DataLabel, Data.Top);
                    Canvas.SetLeft(DataLabel, ZeroReference);
                }
            }

            Func <double> getY = () =>
            {
                var r = Data.Top + Data.Height / 2 - DataLabel.ActualHeight / 2;

                if (r < 0)
                {
                    r = 2;
                }
                if (r + DataLabel.ActualHeight > chart.DrawMargin.Height)
                {
                    r -= r + DataLabel.ActualHeight - chart.DrawMargin.Height + 2;
                }

                return(r);
            };

            Func <double> getX = () =>
            {
                double r;

                if (LabelPosition == BarLabelPosition.Merged)
                {
                    r = Data.Left + Data.Width / 2 - DataLabel.ActualWidth / 2;
                }
                else
                {
                    if (Data.Left < ZeroReference)
                    {
                        r = Data.Left - DataLabel.ActualWidth - 5;
                        if (r < 0)
                        {
                            r = Data.Left + 5;
                        }
                    }
                    else
                    {
                        r = Data.Left + Data.Width + 5;
                        if (r + DataLabel.ActualWidth > chart.DrawMargin.Width)
                        {
                            r -= DataLabel.ActualWidth + 10;
                        }
                    }
                }

                return(r);
            };

            if (chart.View.DisableAnimations)
            {
                Rectangle.Width  = Data.Width;
                Rectangle.Height = Data.Height;

                Canvas.SetTop(Rectangle, Data.Top);
                Canvas.SetLeft(Rectangle, Data.Left);

                if (DataLabel != null)
                {
                    DataLabel.UpdateLayout();

                    Canvas.SetTop(DataLabel, getY());
                    Canvas.SetLeft(DataLabel, getX());
                }

                if (HoverShape != null)
                {
                    Canvas.SetTop(HoverShape, Data.Top);
                    Canvas.SetLeft(HoverShape, Data.Left);
                    HoverShape.Height = Data.Height;
                    HoverShape.Width  = Data.Width;
                }

                return;
            }

            var animSpeed = chart.View.AnimationsSpeed;

            if (DataLabel != null)
            {
                DataLabel.UpdateLayout();

                DataLabel.CreateCanvasStoryBoardAndBegin(getX(), getY(), animSpeed);
            }

            Rectangle.BeginDoubleAnimation("(Canvas.Top)", Data.Top, animSpeed);
            Rectangle.BeginDoubleAnimation("(Canvas.Left)", Data.Left, animSpeed);

            Rectangle.BeginDoubleAnimation("Height", Data.Height, animSpeed);
            Rectangle.BeginDoubleAnimation("Width", Data.Width, animSpeed);

            if (HoverShape != null)
            {
                Canvas.SetTop(HoverShape, Data.Top);
                Canvas.SetLeft(HoverShape, Data.Left);
                HoverShape.Height = Data.Height;
                HoverShape.Width  = Data.Width;
            }
        }
Exemplo n.º 2
0
        public override void DrawOrMove(ChartPoint previousDrawn, ChartPoint current, int index, ChartCore chart)
        {
            if (IsNew)
            {
                Canvas.SetTop(Rectangle, ZeroReference);
                Canvas.SetLeft(Rectangle, Data.Left);

                Rectangle.Width  = Data.Width;
                Rectangle.Height = 0;
            }

            if (DataLabel != null && double.IsNaN(Canvas.GetLeft(DataLabel)))
            {
                Canvas.SetTop(DataLabel, ZeroReference);
                Canvas.SetLeft(DataLabel, current.ChartLocation.X);
            }

            Func <double> getY = () =>
            {
                double y;

#pragma warning disable 618
                if (LabelPosition == BarLabelPosition.Parallel || LabelPosition == BarLabelPosition.Merged)
#pragma warning restore 618
                {
                    if (Transform == null)
                    {
                        Transform = new RotateTransform {
                            Angle = 270
                        }
                    }
                    ;

                    y = Data.Top + Data.Height / 2 + DataLabel.ActualWidth * .5;
                    DataLabel.RenderTransform = Transform;
                }
                else if (LabelPosition == BarLabelPosition.Perpendicular)
                {
                    y = Data.Top + Data.Height / 2 - DataLabel.ActualHeight * .5;
                }
                else
                {
                    if (ZeroReference > Data.Top)
                    {
                        y = Data.Top - DataLabel.ActualHeight;
                        if (y < 0)
                        {
                            y = Data.Top;
                        }
                    }
                    else
                    {
                        y = Data.Top + Data.Height;
                        if (y + DataLabel.ActualHeight > chart.DrawMargin.Height)
                        {
                            y -= DataLabel.ActualHeight;
                        }
                    }
                }

                return(y);
            };

            Func <double> getX = () =>
            {
                double x;

#pragma warning disable 618
                if (LabelPosition == BarLabelPosition.Parallel || LabelPosition == BarLabelPosition.Merged)
#pragma warning restore 618
                {
                    x = Data.Left + Data.Width / 2 - DataLabel.ActualHeight / 2;
                }
                else if (LabelPosition == BarLabelPosition.Perpendicular)
                {
                    x = Data.Left + Data.Width / 2 - DataLabel.ActualWidth / 2;
                }
                else
                {
                    x = Data.Left + Data.Width / 2 - DataLabel.ActualWidth / 2;
                    if (x < 0)
                    {
                        x = 2;
                    }
                    if (x + DataLabel.ActualWidth > chart.DrawMargin.Width)
                    {
                        x -= x + DataLabel.ActualWidth - chart.DrawMargin.Width + 2;
                    }
                }

                return(x);
            };

            if (chart.View.DisableAnimations)
            {
                Rectangle.Width  = Data.Width;
                Rectangle.Height = Data.Height;

                Canvas.SetTop(Rectangle, Data.Top);
                Canvas.SetLeft(Rectangle, Data.Left);

                if (DataLabel != null)
                {
                    DataLabel.UpdateLayout();

                    Canvas.SetTop(DataLabel, getY());
                    Canvas.SetLeft(DataLabel, getX());
                }

                if (HoverShape != null)
                {
                    Canvas.SetTop(HoverShape, Data.Top);
                    Canvas.SetLeft(HoverShape, Data.Left);
                    HoverShape.Height = Data.Height;
                    HoverShape.Width  = Data.Width;
                }

                return;
            }

            var animSpeed = chart.View.AnimationsSpeed;

            if (DataLabel != null)
            {
                DataLabel.UpdateLayout();

                DataLabel.CreateCanvasStoryBoardAndBegin(getX(), getY(), animSpeed);
            }

            Rectangle.BeginDoubleAnimation("(Canvas.Left)", Data.Left, animSpeed);
            Rectangle.BeginDoubleAnimation("(Canvas.Top)", Data.Top, animSpeed);

            Rectangle.BeginDoubleAnimation("(Canvas.Height)", Data.Width, animSpeed);
            Rectangle.BeginDoubleAnimation(nameof(FrameworkElement.Height), Data.Height, animSpeed);

            if (HoverShape != null)
            {
                Canvas.SetTop(HoverShape, Data.Top);
                Canvas.SetLeft(HoverShape, Data.Left);
                HoverShape.Height = Data.Height;
                HoverShape.Width  = Data.Width;
            }
        }
Exemplo n.º 3
0
        public override void DrawOrMove(ChartPoint previousDrawn, ChartPoint current, int index, ChartCore chart)
        {
            var previosPbv = previousDrawn == null
                ? null
                : (HorizontalBezierPointView)previousDrawn.View;

            var y = chart.DrawMargin.Top + chart.DrawMargin.Height;

            Container.Segments.Remove(Segment);
            Container.Segments.Insert(index, Segment);

            if (IsNew)
            {
                if (previosPbv != null && !previosPbv.IsNew)
                {
                    Segment.Point1 = previosPbv.Segment.Point3;
                    Segment.Point2 = previosPbv.Segment.Point3;
                    Segment.Point3 = previosPbv.Segment.Point3;

                    if (DataLabel != null)
                    {
                        Canvas.SetTop(DataLabel, Canvas.GetTop(previosPbv.DataLabel));
                        Canvas.SetLeft(DataLabel, Canvas.GetLeft(previosPbv.DataLabel));
                    }

                    if (Shape != null)
                    {
                        Canvas.SetTop(Shape, Canvas.GetTop(previosPbv.Shape));
                        Canvas.SetLeft(Shape, Canvas.GetLeft(previosPbv.Shape));
                    }
                }
                else
                {
                    Segment.Point1 = new Point(Data.Point1.X, y);
                    Segment.Point2 = new Point(Data.Point2.X, y);
                    Segment.Point3 = new Point(Data.Point3.X, y);

                    if (DataLabel != null)
                    {
                        Canvas.SetTop(DataLabel, y);
                        Canvas.SetLeft(DataLabel, current.ChartLocation.X - DataLabel.ActualWidth * .5);
                    }

                    if (Shape != null)
                    {
                        Canvas.SetTop(Shape, y);
                        Canvas.SetLeft(Shape, current.ChartLocation.X - Shape.Width * .5);
                    }
                }
            }
            else if (DataLabel != null && double.IsNaN(Canvas.GetLeft(DataLabel)))
            {
                Canvas.SetTop(DataLabel, y);
                Canvas.SetLeft(DataLabel, current.ChartLocation.X - DataLabel.ActualWidth * .5);
            }

            #region No Animated

            if (chart.View.DisableAnimations)
            {
                Segment.Point1 = Data.Point1.AsPoint();
                Segment.Point2 = Data.Point2.AsPoint();
                Segment.Point3 = Data.Point3.AsPoint();

                if (HoverShape != null)
                {
                    Canvas.SetLeft(HoverShape, current.ChartLocation.X - HoverShape.Width * .5);
                    Canvas.SetTop(HoverShape, current.ChartLocation.Y - HoverShape.Height * .5);
                }

                if (Shape != null)
                {
                    Canvas.SetLeft(Shape, current.ChartLocation.X - Shape.Width * .5);
                    Canvas.SetTop(Shape, current.ChartLocation.Y - Shape.Height * .5);
                }

                if (DataLabel != null)
                {
                    DataLabel.UpdateLayout();
                    var xl = CorrectXLabel(current.ChartLocation.X - DataLabel.ActualWidth * .5, chart);
                    var yl = CorrectYLabel(current.ChartLocation.Y - DataLabel.ActualHeight * .5, chart);
                    Canvas.SetLeft(DataLabel, xl);
                    Canvas.SetTop(DataLabel, yl);
                }
                return;
            }

            #endregion

            var animSpeed = chart.View.AnimationsSpeed;

            Segment.BeginPointAnimation(nameof(BezierSegment.Point1), Data.Point1.AsPoint(), animSpeed);
            Segment.BeginPointAnimation(nameof(BezierSegment.Point2), Data.Point2.AsPoint(), animSpeed);
            Segment.BeginPointAnimation(nameof(BezierSegment.Point3), Data.Point3.AsPoint(), animSpeed);

            if (Shape != null)
            {
                if (double.IsNaN(Canvas.GetLeft(Shape)))
                {
                    Canvas.SetLeft(Shape, current.ChartLocation.X - Shape.Width * .5);
                    Canvas.SetTop(Shape, current.ChartLocation.Y - Shape.Height * .5);
                }
                else
                {
                    Shape.CreateCanvasStoryBoardAndBegin(current.ChartLocation.X - Shape.Width * .5,
                                                         current.ChartLocation.Y - Shape.Height * .5, chart.View.AnimationsSpeed);
                }
            }

            if (DataLabel != null)
            {
                DataLabel.UpdateLayout();

                var xl = CorrectXLabel(current.ChartLocation.X - DataLabel.ActualWidth * .5, chart);
                var yl = CorrectYLabel(current.ChartLocation.Y - DataLabel.ActualHeight * .5, chart);

                DataLabel.CreateCanvasStoryBoardAndBegin(xl, yl, chart.View.AnimationsSpeed);
            }

            if (HoverShape != null)
            {
                Canvas.SetLeft(HoverShape, current.ChartLocation.X - HoverShape.Width * .5);
                Canvas.SetTop(HoverShape, current.ChartLocation.Y - HoverShape.Height * .5);
            }
        }
Exemplo n.º 4
0
        public override void DrawOrMove(ChartPoint previousDrawn, ChartPoint current, int index, ChartCore chart)
        {
            if (IsNew)
            {
                Canvas.SetTop(Rectangle, Data.Top);
                Canvas.SetLeft(Rectangle, ZeroReference);

                Rectangle.Width  = 0;
                Rectangle.Height = Data.Height;
            }

            if (DataLabel != null && double.IsNaN(Canvas.GetLeft(DataLabel)))
            {
                Canvas.SetTop(DataLabel, Data.Top);
                Canvas.SetLeft(DataLabel, ZeroReference);
            }

            Func <double> getY = () =>
            {
                if (LabelPosition == BarLabelPosition.Perpendicular)
                {
                    if (Transform == null)
                    {
                        Transform = new RotateTransform {
                            Angle = 270
                        }
                    }
                    ;

                    DataLabel.RenderTransform = Transform;
                    return(Data.Top + Data.Height / 2 + DataLabel.ActualWidth * .5);
                }

                var r = Data.Top + Data.Height / 2 - DataLabel.ActualHeight / 2;

                if (r < 0)
                {
                    r = 2;
                }
                if (r + DataLabel.ActualHeight > chart.DrawMargin.Height)
                {
                    r -= r + DataLabel.ActualHeight - chart.DrawMargin.Height + 2;
                }

                return(r);
            };

            Func <double> getX = () =>
            {
                double r;

#pragma warning disable 618
                if (LabelPosition == BarLabelPosition.Parallel || LabelPosition == BarLabelPosition.Merged)
#pragma warning restore 618
                {
                    r = Data.Left + Data.Width / 2 - DataLabel.ActualWidth / 2;
                }
                else if (LabelPosition == BarLabelPosition.Perpendicular)
                {
                    r = Data.Left + Data.Width / 2 - DataLabel.ActualHeight / 2;
                }
                else
                {
                    if (Data.Left < ZeroReference)
                    {
                        r = Data.Left - DataLabel.ActualWidth - 5;
                        if (r < 0)
                        {
                            r = Data.Left + 5;
                        }
                    }
                    else
                    {
                        r = Data.Left + Data.Width + 5;
                        if (r + DataLabel.ActualWidth > chart.DrawMargin.Width)
                        {
                            r -= DataLabel.ActualWidth + 10;
                        }
                    }
                }

                return(r);
            };

            if (chart.View.DisableAnimations)
            {
                Rectangle.Width  = Data.Width;
                Rectangle.Height = Data.Height;

                Canvas.SetTop(Rectangle, Data.Top);
                Canvas.SetLeft(Rectangle, Data.Left);

                if (DataLabel != null)
                {
                    DataLabel.UpdateLayout();

                    Canvas.SetTop(DataLabel, getY());
                    Canvas.SetLeft(DataLabel, getX());
                }

                if (HoverShape != null)
                {
                    Canvas.SetTop(HoverShape, Data.Top);
                    Canvas.SetLeft(HoverShape, Data.Left);
                    HoverShape.Height = Data.Height;
                    HoverShape.Width  = Data.Width;
                }

                return;
            }

            var animSpeed = chart.View.AnimationsSpeed;

            if (DataLabel != null)
            {
                DataLabel.UpdateLayout();

                DataLabel.CreateCanvasStoryBoardAndBegin(getX(), getY(), animSpeed);
            }

            Rectangle.BeginDoubleAnimation("(Canvas.Top)", Data.Top, animSpeed);
            Rectangle.BeginDoubleAnimation("(Canvas.Left)", Data.Left, animSpeed);

            Rectangle.BeginDoubleAnimation("Height", Data.Height, animSpeed);
            Rectangle.BeginDoubleAnimation("Width", Data.Width, animSpeed);

            if (HoverShape != null)
            {
                Canvas.SetTop(HoverShape, Data.Top);
                Canvas.SetLeft(HoverShape, Data.Left);
                HoverShape.Height = Data.Height;
                HoverShape.Width  = Data.Width;
            }
        }
Exemplo n.º 5
0
        public override void DrawOrMove(ChartPoint previousDrawn, ChartPoint current, int index, ChartCore chart)
        {
            if (IsNew)
            {
                Canvas.SetTop(Shape, current.ChartLocation.Y);
                Canvas.SetLeft(Shape, current.ChartLocation.X);

                Shape.Width  = 0;
                Shape.Height = 0;
            }

            if (DataLabel != null && double.IsNaN(Canvas.GetLeft(DataLabel)))
            {
                Canvas.SetTop(DataLabel, current.ChartLocation.Y);
                Canvas.SetLeft(DataLabel, current.ChartLocation.X);
            }

            if (HoverShape != null)
            {
                HoverShape.Width  = Diameter;
                HoverShape.Height = Diameter;
                Canvas.SetLeft(HoverShape, current.ChartLocation.X - Diameter / 2);
                Canvas.SetTop(HoverShape, current.ChartLocation.Y - Diameter / 2);
            }

            if (chart.View.DisableAnimations)
            {
                Shape.Width  = Diameter;
                Shape.Height = Diameter;

                Canvas.SetTop(Shape, current.ChartLocation.Y - Shape.Height * .5);
                Canvas.SetLeft(Shape, current.ChartLocation.X - Shape.Width * .5);

                if (DataLabel != null)
                {
                    DataLabel.UpdateLayout();

                    var cx = CorrectXLabel(current.ChartLocation.X - DataLabel.ActualWidth * .5, chart);
                    var cy = CorrectYLabel(current.ChartLocation.Y - DataLabel.ActualHeight * .5, chart);

                    Canvas.SetTop(DataLabel, cy);
                    Canvas.SetLeft(DataLabel, cx);
                }

                return;
            }

            var animSpeed = chart.View.AnimationsSpeed;

            if (DataLabel != null)
            {
                DataLabel.UpdateLayout();

                var cx = CorrectXLabel(current.ChartLocation.X - DataLabel.ActualWidth * .5, chart);
                var cy = CorrectYLabel(current.ChartLocation.Y - DataLabel.ActualHeight * .5, chart);

                DataLabel.CreateCanvasStoryBoardAndBegin(cx, cy, animSpeed);
            }

            Shape.BeginDoubleAnimation(nameof(FrameworkElement.Width), Diameter, animSpeed);
            Shape.BeginDoubleAnimation(nameof(FrameworkElement.Height), Diameter, animSpeed);

            Shape.CreateCanvasStoryBoardAndBegin(current.ChartLocation.X - Diameter * .5,
                                                 current.ChartLocation.Y - Diameter * .5, animSpeed);
        }
Exemplo n.º 6
0
        public override void DrawOrMove(ChartPoint previousDrawn, ChartPoint current, int index, ChartCore chart)
        {
            var center = Left + Width / 2;

            if (IsNew)
            {
                HighToLowLine.X1 = center;
                HighToLowLine.X2 = center;
                HighToLowLine.Y1 = StartReference;
                HighToLowLine.Y2 = StartReference;

                Canvas.SetTop(OpenToCloseRectangle, (Open + Close) / 2);
                Canvas.SetLeft(OpenToCloseRectangle, Left);

                OpenToCloseRectangle.Width  = Width;
                OpenToCloseRectangle.Height = 0;
            }

            if (DataLabel != null && double.IsNaN(Canvas.GetLeft(DataLabel)))
            {
                Canvas.SetTop(DataLabel, current.ChartLocation.Y);
                Canvas.SetLeft(DataLabel, current.ChartLocation.X);
            }

            if (HoverShape != null)
            {
                var h = Math.Abs(High - Low);
                HoverShape.Width  = Width;
                HoverShape.Height = h > 10 ? h : 10;
                Canvas.SetLeft(HoverShape, Left);
                Canvas.SetTop(HoverShape, High);
            }

            if (chart.View.DisableAnimations)
            {
                HighToLowLine.Y1 = High;
                HighToLowLine.Y2 = Low;
                HighToLowLine.X1 = center;
                HighToLowLine.X2 = center;

                OpenToCloseRectangle.Width  = Width;
                OpenToCloseRectangle.Height = Math.Abs(Open - Close);

                Canvas.SetTop(OpenToCloseRectangle, Math.Min(Open, Close));
                Canvas.SetLeft(OpenToCloseRectangle, Left);

                if (DataLabel != null)
                {
                    DataLabel.UpdateLayout();

                    var cx = CorrectXLabel(current.ChartLocation.X - DataLabel.ActualHeight * .5, chart);
                    var cy = CorrectYLabel(current.ChartLocation.Y - DataLabel.ActualWidth * .5, chart);

                    Canvas.SetTop(DataLabel, cy);
                    Canvas.SetLeft(DataLabel, cx);
                }

                return;
            }

            var animSpeed = chart.View.AnimationsSpeed;

            if (DataLabel != null)
            {
                DataLabel.UpdateLayout();

                var cx = CorrectXLabel(current.ChartLocation.X - DataLabel.ActualWidth * .5, chart);
                var cy = CorrectYLabel(current.ChartLocation.Y - DataLabel.ActualHeight * .5, chart);

                DataLabel.CreateCanvasStoryBoardAndBegin(cx, cy, animSpeed);
            }

            var x1Animation = AnimationsHelper.CreateDouble(center, animSpeed, "Line.X1");
            var x2Animation = AnimationsHelper.CreateDouble(center, animSpeed, "Line.X2");

            AnimationsHelper.CreateStoryBoard(HighToLowLine, x1Animation, x2Animation);

            var y1Animation = AnimationsHelper.CreateDouble(High, animSpeed, "Line.Y1");
            var y2Animation = AnimationsHelper.CreateDouble(Low, animSpeed, "Line.Y2");

            AnimationsHelper.CreateStoryBoardAndBegin(HighToLowLine, y1Animation, y2Animation);

            OpenToCloseRectangle.BeginDoubleAnimation("(Canvas.Left)", Left, animSpeed);
            OpenToCloseRectangle.BeginDoubleAnimation("(Canvas.Top)", Math.Min(Open, Close), animSpeed);

            OpenToCloseRectangle.BeginDoubleAnimation("Width", Width, animSpeed);
            OpenToCloseRectangle.BeginDoubleAnimation("Height", Math.Max(Math.Abs(Open - Close), OpenToCloseRectangle.StrokeThickness), animSpeed);
        }
Exemplo n.º 7
0
        public override void DrawOrMove(ChartPoint previousDrawn, ChartPoint current, int index, ChartCore chart)
        {
            if (IsNew)
            {
                Slice.Width  = chart.DrawMargin.Width;
                Slice.Height = chart.DrawMargin.Height;

                Slice.WedgeAngle    = 0;
                Slice.RotationAngle = 0;
            }

            if (DataLabel != null && double.IsNaN(Canvas.GetLeft(DataLabel)))
            {
                Canvas.SetTop(DataLabel, 0d);
                Canvas.SetLeft(DataLabel, 0d);
            }

            if (HoverShape != null)
            {
                var hs = (PieSlice)HoverShape;

                hs.Width         = chart.DrawMargin.Width;
                hs.Height        = chart.DrawMargin.Height;
                hs.WedgeAngle    = Wedge;
                hs.RotationAngle = Rotation;
                hs.InnerRadius   = InnerRadius;
                hs.Radius        = Radius;
            }

            Slice.Width  = chart.DrawMargin.Width;
            Slice.Height = chart.DrawMargin.Height;

            Slice.InnerRadius = InnerRadius;
            Slice.Radius      = Radius;

            var hypo  = (Slice.Radius + Slice.InnerRadius) / 2;
            var gamma = current.Participation * 360 / 2 + Rotation;
            var cp    = new Point(hypo * Math.Sin(gamma * (Math.PI / 180)), hypo * Math.Cos(gamma * (Math.PI / 180)));

            if (chart.View.DisableAnimations)
            {
                Slice.WedgeAngle    = Wedge;
                Slice.RotationAngle = Rotation;

                if (DataLabel != null)
                {
                    DataLabel.UpdateLayout();

                    var lx = cp.X + chart.DrawMargin.Width / 2 - DataLabel.ActualWidth * .5;
                    var ly = chart.DrawMargin.Height / 2 - cp.Y - DataLabel.ActualHeight * .5;

                    Canvas.SetLeft(DataLabel, lx);
                    Canvas.SetTop(DataLabel, ly);
                }

                return;
            }

            var animSpeed = chart.View.AnimationsSpeed;

            if (DataLabel != null)
            {
                DataLabel.UpdateLayout();

                var lx = cp.X + chart.DrawMargin.Width / 2 - DataLabel.ActualWidth * .5;
                var ly = chart.DrawMargin.Height / 2 - cp.Y - DataLabel.ActualHeight * .5;

                DataLabel.CreateCanvasStoryBoardAndBegin(lx, ly, animSpeed);
            }

            Slice.BeginDoubleAnimation(nameof(PieSlice.WedgeAngle), Wedge, animSpeed);
            Slice.BeginDoubleAnimation(nameof(PieSlice.RotationAngle), Rotation, animSpeed);
        }
Exemplo n.º 8
0
        public override void DrawOrMove(ChartPoint previousDrawn, ChartPoint current, int index, ChartCore chart)
        {
            var center = Left + Width / 2;

            if (IsNew)
            {
                HighToLowLine.X1 = center;
                HighToLowLine.X2 = center;
                HighToLowLine.Y1 = StartReference;
                HighToLowLine.Y2 = StartReference;

                OpenLine.X1 = Left;
                OpenLine.X2 = center;
                OpenLine.Y1 = StartReference;
                OpenLine.Y2 = StartReference;

                CloseLine.X1 = center;
                CloseLine.X2 = Left + Width;
                CloseLine.Y1 = StartReference;
                CloseLine.Y2 = StartReference;

                if (DataLabel != null)
                {
                    Canvas.SetTop(DataLabel, current.ChartLocation.Y);
                    Canvas.SetLeft(DataLabel, current.ChartLocation.X);
                }
            }

            if (HoverShape != null)
            {
                var h = Math.Abs(High - Low);
                HoverShape.Width  = Width;
                HoverShape.Height = h > 10 ? h : 10;
                Canvas.SetLeft(HoverShape, Left);
                Canvas.SetTop(HoverShape, High);
            }

            if (chart.View.DisableAnimations)
            {
                HighToLowLine.Y1 = High;
                HighToLowLine.Y2 = Low;
                HighToLowLine.X1 = center;
                HighToLowLine.X2 = center;

                OpenLine.Y1 = Open;
                OpenLine.Y2 = Open;
                OpenLine.X1 = Left;
                OpenLine.X2 = center;

                CloseLine.Y1 = Close;
                CloseLine.Y2 = Close;
                CloseLine.X1 = center;
                CloseLine.X2 = Left;

                if (DataLabel != null)
                {
                    DataLabel.UpdateLayout();

                    var cx = CorrectXLabel(current.ChartLocation.X - DataLabel.ActualHeight * .5, chart);
                    var cy = CorrectYLabel(current.ChartLocation.Y - DataLabel.ActualWidth * .5, chart);

                    Canvas.SetTop(DataLabel, cy);
                    Canvas.SetLeft(DataLabel, cx);
                }

                return;
            }

            var animSpeed = chart.View.AnimationsSpeed;

            if (DataLabel != null)
            {
                DataLabel.UpdateLayout();

                var cx = CorrectXLabel(current.ChartLocation.X - DataLabel.ActualWidth * .5, chart);
                var cy = CorrectYLabel(current.ChartLocation.Y - DataLabel.ActualHeight * .5, chart);

                DataLabel.CreateCanvasStoryBoardAndBegin(cx, cy, animSpeed);
            }

            HighToLowLine.BeginDoubleAnimation("Line.X1", center, animSpeed);
            HighToLowLine.BeginDoubleAnimation("Line.X2", center, animSpeed);
            OpenLine.BeginDoubleAnimation("Line.X1", Left, animSpeed);
            OpenLine.BeginDoubleAnimation("Line.X2", center, animSpeed);
            CloseLine.BeginDoubleAnimation("Line.X1", center, animSpeed);
            CloseLine.BeginDoubleAnimation("Line.X2", center, animSpeed);

            HighToLowLine.CreateY1Y2StoryBoardAndBegin(High, Low, animSpeed);
            OpenLine.CreateY1Y2StoryBoardAndBegin(Open, Open, animSpeed);
            CloseLine.CreateY1Y2StoryBoardAndBegin(Close, Close, animSpeed);
        }