Ios6 混合CPTSCatterpLotterInterpolationCurve和CPTSCatterpLotterInterpolationLinear的核心图

Ios6 混合CPTSCatterpLotterInterpolationCurve和CPTSCatterpLotterInterpolationLinear的核心图,ios6,xamarin.ios,core-plot,graphing,Ios6,Xamarin.ios,Core Plot,Graphing,我需要能够绘制顺序线段,这些线段的Y坐标与CPTSatterPlotInterpolationLinear和CPTSatterPlotInterpolationCurve相同。 当CPTSpatterPlotionInterpolationCurve绘制所有曲线时。我目前正在通过添加多个绘图来实现这一点 public List<CorrectedGraphPoints> GetCorrectDataPoints(List<PointF> dataSource)

我需要能够绘制顺序线段,这些线段的Y坐标与CPTSatterPlotInterpolationLinear和CPTSatterPlotInterpolationCurve相同。 当CPTSpatterPlotionInterpolationCurve绘制所有曲线时。我目前正在通过添加多个绘图来实现这一点

public List<CorrectedGraphPoints> GetCorrectDataPoints(List<PointF> dataSource)
        {
            int lastIndex = 0;
            bool shouldLoop = true;
            CPTScatterPlotInterpolation interpolation = CPTScatterPlotInterpolation.Curved;
            List<CorrectedGraphPoints> OuterList = new List<CorrectedGraphPoints> ();

            if (dataSource [0].Y == dataSource [1].Y)
                interpolation = CPTScatterPlotInterpolation.Linear;

            while (lastIndex+1 != dataSource.Count) {
                OuterList.Add (new CorrectedGraphPoints (interpolation));

                while (shouldLoop) 
                {

                    OuterList[OuterList.Count -1].Add(dataSource[lastIndex]);
                    if ((lastIndex + 1) < dataSource.Count) {
                        if (interpolation == CPTScatterPlotInterpolation.Linear) {
                            if (dataSource [lastIndex].Y != dataSource [lastIndex + 1].Y) {
                                interpolation = CPTScatterPlotInterpolation.Curved;
                                shouldLoop = false;
                                break;
                            }
                        }

                        if (interpolation == CPTScatterPlotInterpolation.Curved) {
                            if (dataSource [lastIndex].Y == dataSource [lastIndex + 1].Y) {
                                interpolation = CPTScatterPlotInterpolation.Linear;
                                shouldLoop = false;
                                break;
                            }
                        }
                    } 
                    else {
                        shouldLoop = false;
                        break;
                    }

                    if (shouldLoop)
                        lastIndex++;
                }

                shouldLoop = true;
            }

            return OuterList;


        }



public class CorrectedGraphPoints
    {
        private List<PointF> points;
        public List<PointF> Points { get { return points; } }

        private CPTScatterPlotInterpolation interpolation;
        public CPTScatterPlotInterpolation Interpolation { get { return interpolation; } }


        public CorrectedGraphPoints(CPTScatterPlotInterpolation interpolation)
        {
            this.interpolation = interpolation;
            points = new List<PointF> ();
        }

        public void Add(PointF point)
        {
            points.Add (point);
        }
    }
公共列表GetCorrectDataPoints(列表数据源)
{
int lastIndex=0;
bool shouldLoop=true;
CPTSatterPlotInterpolation插值=CPTSatterPlotInterpolation.Curve;
List OuterList=新列表();
if(数据源[0].Y==数据源[1].Y)
插值=CPTSatterPlotInterpolation.Linear;
while(lastIndex+1!=dataSource.Count){
添加(新的校正边曲线点(插值));
while(shouldLoop)
{
OuterList[OuterList.Count-1].Add(数据源[lastIndex]);
if((lastIndex+1)

然而,创建多个使用填充的绘图会大大降低应用程序的速度。我想知道我是否可以限制我做这件事的次数?我还没有找到一种方法来改变一个部分的插值??这只是core plot的一个问题,还是我的逻辑或代码有问题?

另一个可能的解决方案是在数据中添加额外的点来绘制曲线部分。这将允许您仅使用一个绘图。所需的额外点的数量将取决于几个因素,包括绘图的大小和用于绘制线的线样式。

例如,如果在x=0、1、2和3处有点,并且需要一条介于1和2之间的曲线,请在(例如)1.25(@index 2)、1.5(@3)和1.75(@4)处插入点并将2和3处的点移动到指数5和6。