コード例 #1
0
        /// <summary>
        /// Generates the datas.
        /// </summary>
        override public void GenerateDatas()
        {
            CalculateMinAndMax();
            ChartPoint oldPoint = new ChartPoint()
            {
                XValue = double.MinValue, YValue = double.MinValue
            };

            IntializePoints();
            SplinePoints.Clear();
            if (!IsPointsGenerated)
            {
                Parts.Clear();
            }
            if (this.Points != null && this.SeriesContainer != null)
            {
                CalculateMinAndMax();
                foreach (ChartPoint point in this.Points)
                {
                    if (CheckValuePoint(oldPoint, point))
                    {
                        Point linePoint = NormalizePoint(new Point(point.XValue, point.YValue));
                        this.SplinePoints.Add(linePoint);
                    }
                }
                if (this.SplinePoints.Count > 1)
                {
                    BezierSpline.GetCurveControlPoints(this.SplinePoints.ToArray(), out FirstControlPoints, out SecondControlPoints);
                }
                if (this.RenderingMode == RenderingMode.Default)
                {
                    if (!IsPointsGenerated)
                    {
                        for (int i = 0; i < this.SplinePoints.Count - 1; i++)
                        {
                            SplinePart splinePart = new SplinePart(SplinePoints[i], FirstControlPoints[i], SecondControlPoints[i], SplinePoints[i + 1]);
                            SetBindingForStrokeandStrokeThickness(splinePart);
                            this.Parts.Add(splinePart);
                        }
                        IsPointsGenerated = true;
                    }
                    else
                    {
                        int i = 0;
                        foreach (SplinePart part in this.Parts)
                        {
                            part.StartPoint        = SplinePoints[i];
                            part.FirstControlPoint = FirstControlPoints[i];
                            part.EndControlPoint   = SecondControlPoints[i];
                            part.EndPoint          = SplinePoints[i + 1];
                            part.Refresh();
                            i++;
                        }
                    }
                }
            }
            else
            {
                Parts.Clear();
            }
            if (this.SeriesContainer != null)
            {
                this.SeriesContainer.Invalidate();
            }
            IsRefreshed = false;
        }
コード例 #2
0
ファイル: SplineSeries.cs プロジェクト: jcw-/sparrowtoolkit
 /// <summary>
 /// Generates the datas.
 /// </summary>
 public override void GenerateDatas()
 {
     CalculateMinAndMax();
     ChartPoint oldPoint = new ChartPoint() { XValue = double.MinValue, YValue = double.MinValue };
     IntializePoints();
     SplinePoints.Clear();
     if (!IsPointsGenerated)
         Parts.Clear();
     if (this.Points != null && this.SeriesContainer != null)
     {
         CalculateMinAndMax();
         foreach (ChartPoint point in this.Points)
         {
             if (CheckValuePoint(oldPoint,point))
             {
                 Point linePoint = NormalizePoint(new Point(point.XValue, point.YValue));
                 this.SplinePoints.Add(linePoint);
             }
         }
         if (this.SplinePoints.Count > 1)
             BezierSpline.GetCurveControlPoints(this.SplinePoints.ToArray(), out FirstControlPoints, out SecondControlPoints);
         if (this.RenderingMode == RenderingMode.Default)
         {
             if (!IsPointsGenerated)
             {
                 for (int i = 0; i < this.SplinePoints.Count - 1; i++)
                 {
                     SplinePart splinePart = new SplinePart(SplinePoints[i], FirstControlPoints[i], SecondControlPoints[i], SplinePoints[i + 1]);
                     SetBindingForStrokeandStrokeThickness(splinePart);
                     this.Parts.Add(splinePart);
                 }
                 IsPointsGenerated = true;
             }
             else
             {
                 int i = 0;
                 foreach (SplinePart part in this.Parts)
                 {
                     part.StartPoint = SplinePoints[i];
                     part.FirstControlPoint = FirstControlPoints[i];
                     part.EndControlPoint = SecondControlPoints[i];
                     part.EndPoint = SplinePoints[i + 1];
                     part.Refresh();
                     i++;
                 }
             }
         }
     }
     else
     {
       Parts.Clear();
     }
     if (this.SeriesContainer != null)
         this.SeriesContainer.Invalidate();
     IsRefreshed = false;
 }