Inheritance: ISeriesGeometryBuilder
        public object GetGeometry(Point[] points, Point[] previousPoints)
        {
            var arr  = ConvertToStepPoints(points);
            var arr2 = ConvertToStepPoints(previousPoints);

            return(PolylineGeometryBuilder.CreateGeometry(arr, arr2));
        }
示例#2
0
        public object GetGeometry(Point[] points, Point[] previousPoints)
        {
            if (points.Length < 2)
            {
                return(PolylineGeometryBuilder.CreateGeometry(points, previousPoints));
            }

            var             curvePoints  = CreateCurvePoints(points, this.Tension);
            PointCollection curvePoints2 = null;

            if (previousPoints != null)
            {
                if (previousPoints.Length < 2)
                {
                    throw new MvvmChartUnexpectedTypeException($"GetGeometry: previousPoints.Length={previousPoints.Length < 2}");
                }

                if (previousPoints.Length == 2)
                {
                    curvePoints2 = new PointCollection();
                    for (int i = 0; i < previousPoints.Length; i++)
                    {
                        curvePoints2.Add(previousPoints[previousPoints.Length - 1 - i]);
                    }
                }
                else
                {
                    curvePoints2 = CreateCurvePoints(previousPoints.Reversed(), this.Tension);
                }
            }

            var figure       = CreateSpline(curvePoints, curvePoints2);
            var pathGeometry = new PathGeometry();

            pathGeometry.Figures.Add(figure);
            figure.IsClosed = previousPoints != null;
            figure.Freeze();

            return(pathGeometry);
        }