public void DrawLimits(Point first, Point last, Point minPoint, Chart chart) { Figure.Segments.Remove(Right); Figure.Segments.Remove(Bottom); Figure.Segments.Remove(Left); Figure.Segments.Add(Right); Figure.Segments.Add(Bottom); Figure.Segments.Add(Left); Point r, b; var l = new Point(first.X, first.Y); if (chart.Invert) { r = new Point(minPoint.X, last.Y); b = new Point(minPoint.X, first.Y); } else { r = new Point(last.X, minPoint.Y); b = new Point(first.X, minPoint.Y); } if (chart.DisableAnimations || _firstRun) { Right.Point = r; Bottom.Point = b; Left.Point = l; } else { Right.BeginAnimation(LineSegment.PointProperty, new PointAnimation(r, chart.AnimationsSpeed)); Bottom.BeginAnimation(LineSegment.PointProperty, new PointAnimation(b, chart.AnimationsSpeed)); Left.BeginAnimation(LineSegment.PointProperty, new PointAnimation(l, chart.AnimationsSpeed)); } _firstRun = false; }