Exemple #1
0
    // returns the next tick interval if current x corresponds to both the section number at interval increase and a factor of ten.
    // else returns current interval
    int GetNewXTickInterval()
    {
        float newXBaseInterval = (float)CurrentPointNum / (float)xSectNumAtIntervalIncrease;

        // can't be a new interval if the new base interval is not a whole number
        if (newXBaseInterval != (int)newXBaseInterval)
        {
            return(xTickInterval);
        }

        // working with base interval (divided by the interval increase rate)
        int   tenMultiplier      = (int)Mathf.Pow(10, MathScientific.GetTenPow(newXBaseInterval));
        float baseIntervalAsUnit = (float)(newXBaseInterval) / (float)(tenMultiplier);

        if (baseIntervalAsUnit == 1)
        {
            return(2 * tenMultiplier);
        }
        if (baseIntervalAsUnit == 2)
        {
            return(5 * tenMultiplier);
        }
        if (baseIntervalAsUnit == 5)
        {
            return(10 * tenMultiplier);
        }

        return(xTickInterval);
    }
 // sets a base number of significant figures to ensure the interval is always visible.
 private void _SetBaseSigFigs()
 {
     _baseSigFigs = MathScientific.GetTenPow((RawMax + RawMin) / (RawMax - RawMin));
 }