private int GetFractionIndex(int x)
        {
            for (int i = 1; i < fractions.Count(); i++)
            {
                FractionPositionF start = fractions[i - 1];
                FractionPositionF end   = fractions[i];
                if (start == null || end == null)
                {
                    return(-1);
                }
                if (i == 1)
                {
                    if (x >= start.x && x <= end.x)
                    {
                        return(i);
                    }
                }
                else
                {
                    if (x > start.x && x <= end.x)
                    {
                        return(i);
                    }
                }
            }

            return(-1);
        }
 public void SetFraction(int index, int x)
 {
     fractions[index] = new FractionPositionF
     {
         x = x,
         y = Raw.GetPoint(x)
     };
 }
 public void SetFraction(int index, int x)
 {
     fractions[index] = new FractionPositionF
     {
         x = x,
         y = Raw.GetPoint(x)
     };
 }
        public double GetFractionTotal()
        {
            double result = 0;

            for (int i = 1; i < fractions.Count(); i++)
            {
                FractionPositionF start = fractions[i - 1];
                FractionPositionF end   = fractions[i];
                if (start == null || end == null)
                {
                    break;
                }
                if (i == 1)
                {
                    result += GetFractionTotal(start.x, end.x);
                }
                else
                {
                    result += GetFractionTotal(start.x + 1, end.x);
                }
            }
            return(result);
        }