Example #1
0
        public virtual void StartSegment(int atIndex, CorePoint location)
        {
            if (Splitters.Count <= ActiveSplitters)
            {
                Splitters.Add(new LineSegmentSplitter {
                    IsNew = true
                });
            }

            var splitter = Splitters[ActiveSplitters];

            splitter.SplitterCollectorIndex = SplittersCollector;

            ActiveSplitters++;
            var animSpeed = Model.Chart.View.AnimationsSpeed;
            var noAnim    = Model.Chart.View.DisableAnimations;

            if (atIndex != 0)
            {
                Figure.Segments.Remove(splitter.Bottom);

                if (splitter.IsNew)
                {
                    splitter.Bottom.Point = new Point(location.X, Model.Chart.DrawMargin.Height);
                    splitter.Left.Point   = new Point(location.X, Model.Chart.DrawMargin.Height);
                }

                if (noAnim)
                {
                    splitter.Bottom.Point = new Point(location.X, Model.Chart.DrawMargin.Height);
                }
                else
                {
                    splitter.Bottom.BeginAnimation(LineSegment.PointProperty,
                                                   new PointAnimation(new Point(location.X, Model.Chart.DrawMargin.Height), animSpeed));
                }
                Figure.Segments.Insert(atIndex, splitter.Bottom);

                Figure.Segments.Remove(splitter.Left);
                if (noAnim)
                {
                    splitter.Left.Point = location.AsPoint();
                }
                else
                {
                    splitter.Left.BeginAnimation(LineSegment.PointProperty,
                                                 new PointAnimation(location.AsPoint(), animSpeed));
                }
                Figure.Segments.Insert(atIndex + 1, splitter.Left);

                return;
            }

            if (splitter.IsNew)
            {
                splitter.Bottom.Point = new Point(location.X, Model.Chart.DrawMargin.Height);
                splitter.Left.Point   = new Point(location.X, Model.Chart.DrawMargin.Height);
            }

            Figure.Segments.Remove(splitter.Left);
            if (Model.Chart.View.DisableAnimations)
            {
                splitter.Left.Point = location.AsPoint();
            }
            else
            {
                splitter.Left.BeginAnimation(LineSegment.PointProperty,
                                             new PointAnimation(location.AsPoint(), animSpeed));
            }
            Figure.Segments.Insert(atIndex, splitter.Left);
        }
Example #2
0
        /// <summary>
        /// Starts the segment.
        /// </summary>
        /// <param name="atIndex">At index.</param>
        /// <param name="location">The location.</param>
        public override void StartSegment(int atIndex, CorePoint location)
        {
            if (Splitters.Count <= ActiveSplitters)
            {
                Splitters.Add(new LineSegmentSplitter {
                    IsNew = true
                });
            }

            var splitter = Splitters[ActiveSplitters];

            splitter.SplitterCollectorIndex = SplittersCollector;

            ActiveSplitters++;
            var animSpeed = Model.Chart.View.AnimationsSpeed;
            var noAnim    = Model.Chart.View.DisableAnimations;

            var areaLimit = ChartFunctions.ToDrawMargin(double.IsNaN(AreaLimit)
                ? Model.Chart.AxisX[ScalesXAt].FirstSeparator
                : AreaLimit, AxisOrientation.X, Model.Chart, ScalesXAt);

            if (Values != null && atIndex == 0)
            {
                if (Model.Chart.View.DisableAnimations || IsNew)
                {
                    Figure.StartPoint = new Point(areaLimit, location.Y);
                }
                else
                {
                    Figure.BeginAnimation(PathFigure.StartPointProperty,
                                          new PointAnimation(new Point(areaLimit, location.Y), animSpeed));
                }

                IsNew = false;
            }

            if (atIndex != 0)
            {
                Figure.Segments.Remove(splitter.Bottom);

                if (splitter.IsNew)
                {
                    splitter.Bottom.Point = new Point(Model.Chart.DrawMargin.Width, location.Y);
                    splitter.Left.Point   = new Point(Model.Chart.DrawMargin.Width, location.Y);
                }

                if (noAnim)
                {
                    splitter.Bottom.Point = new Point(Model.Chart.DrawMargin.Width, location.Y);
                }
                else
                {
                    splitter.Bottom.BeginAnimation(LineSegment.PointProperty,
                                                   new PointAnimation(new Point(Model.Chart.DrawMargin.Width, location.Y), animSpeed));
                }
                Figure.Segments.Insert(atIndex, splitter.Bottom);

                Figure.Segments.Remove(splitter.Left);
                if (noAnim)
                {
                    splitter.Left.Point = location.AsPoint();
                }
                else
                {
                    splitter.Left.BeginAnimation(LineSegment.PointProperty,
                                                 new PointAnimation(location.AsPoint(), animSpeed));
                }
                Figure.Segments.Insert(atIndex + 1, splitter.Left);

                return;
            }

            if (splitter.IsNew)
            {
                splitter.Bottom.Point = new Point(location.X, Model.Chart.DrawMargin.Height);
                splitter.Left.Point   = new Point(location.X, Model.Chart.DrawMargin.Height);
            }

            Figure.Segments.Remove(splitter.Left);
            if (Model.Chart.View.DisableAnimations)
            {
                splitter.Left.Point = location.AsPoint();
            }
            else
            {
                splitter.Left.BeginAnimation(LineSegment.PointProperty,
                                             new PointAnimation(location.AsPoint(), animSpeed));
            }
            Figure.Segments.Insert(atIndex, splitter.Left);
        }
        /// <summary>
        /// Starts the segment.
        /// </summary>
        /// <param name="atIndex">At index.</param>
        /// <param name="location">The location.</param>
        public virtual void StartSegment(int atIndex, CorePoint location)
        {
            if (Splitters.Count <= ActiveSplitters)
            {
                Splitters.Add(new LineSegmentSplitter {
                    IsNew = true
                });
            }

            var splitter = Splitters[ActiveSplitters];

            splitter.SplitterCollectorIndex = SplittersCollector;

            ActiveSplitters++;
            var animSpeed = Model.Chart.View.AnimationsSpeed;
            var noAnim    = Model.Chart.View.DisableAnimations;

            var areaLimit = Model.Chart.DrawMargin.Height;

            if (!double.IsNaN(AreaLimit))
            {
                areaLimit = ChartFunctions.ToDrawMargin(AreaLimit, AxisOrientation.Y, Model.Chart, ScalesYAt);
            }

            if (Values != null)
            {
                if (Model.Chart.View.DisableAnimations || IsNew)
                {
                    Figure.StartPoint = new Point(location.X, areaLimit);
                }
                else
                {
                    Figure.BeginPointAnimation(nameof(PathFigure.StartPoint),
                                               new Point(location.X, areaLimit), Model.Chart.View.AnimationsSpeed);
                }

                IsNew = false;
            }

            if (atIndex != 0)
            {
                Figure.Segments.Remove(splitter.Bottom);

                if (splitter.IsNew)
                {
                    splitter.Bottom.Point = new Point(location.X, Model.Chart.DrawMargin.Height);
                    splitter.Left.Point   = new Point(location.X, Model.Chart.DrawMargin.Height);
                }

                if (noAnim)
                {
                    splitter.Bottom.Point = new Point(location.X, Model.Chart.DrawMargin.Height);
                }
                else
                {
                    splitter.Bottom.BeginPointAnimation(nameof(LineSegment.Point), new Point(location.X, Model.Chart.DrawMargin.Height), animSpeed);
                }
                Figure.Segments.Insert(atIndex, splitter.Bottom);

                Figure.Segments.Remove(splitter.Left);
                if (noAnim)
                {
                    splitter.Left.Point = location.AsPoint();
                }
                else
                {
                    splitter.Left.BeginPointAnimation(nameof(LineSegment.Point), location.AsPoint(), animSpeed);
                }
                Figure.Segments.Insert(atIndex + 1, splitter.Left);

                return;
            }

            if (splitter.IsNew)
            {
                splitter.Bottom.Point = new Point(location.X, Model.Chart.DrawMargin.Height);
                splitter.Left.Point   = new Point(location.X, Model.Chart.DrawMargin.Height);
            }

            Figure.Segments.Remove(splitter.Left);
            if (Model.Chart.View.DisableAnimations)
            {
                splitter.Left.Point = location.AsPoint();
            }
            else
            {
                splitter.Left.BeginPointAnimation(nameof(LineSegment.Point), location.AsPoint(), animSpeed);
            }
            Figure.Segments.Insert(atIndex, splitter.Left);
        }