Exemplo n.º 1
0
Arquivo: Utils.cs Projeto: Daoting/dt
        public static double GetMajorUnit(double range, IAxis ax, double delta = 0.0)
        {
            double majorUnit = ax.MajorUnit;

            if (double.IsNaN(majorUnit))
            {
                int    num2 = NicePrecision(range);
                double x    = range / ((double)ax.GetAnnoNumber());
                if (delta == 0.0)
                {
                    delta = NiceNumber(2.0 * x, -num2, true);
                    if (delta < x)
                    {
                        delta = NiceNumber(x, -num2 + 1, false);
                    }
                    if (delta < x)
                    {
                        delta = NiceTickNumber(x);
                    }
                }
                return(delta);
            }
            delta = majorUnit;
            return(delta);
        }