Пример #1
0
        /// <summary>
        /// Gets an array of ticks for specified axis range.
        /// </summary>
        public double[] GetTicks()
        {
            double start  = Range.Min;
            double finish = Range.Max;
            double d      = finish - start;

            if (d == 0)
            {
                return new double[] { start, finish }
            }
            ;

            double        temp  = delta * Math.Pow(10, beta);
            double        min   = Math.Floor(start / temp);
            double        max   = Math.Floor(finish / temp);
            int           count = (int)(max - min + 1);
            List <double> res   = new List <double>();
            double        x0    = min * temp;

            for (int i = 0; i < count + 1; i++)
            {
                double v = RoundHelper.Round(x0 + i * temp, beta);
                if (v >= start && v <= finish)
                {
                    res.Add(v);
                }
            }
            return(res.ToArray());
        }
Пример #2
0
        /// <summary>
        /// Generates minor ticks in specified range.
        /// </summary>
        /// <param name="range">The range.</param>
        /// <returns>An array of minor ticks.</returns>
        public double[] GetMinorTicks(Range range)
        {
            var    ticks = new List <double>(GetTicks());
            double temp  = delta * Math.Pow(10, beta);

            ticks.Insert(0, RoundHelper.Round(ticks[0] - temp, beta));
            ticks.Add(RoundHelper.Round(ticks[ticks.Count - 1] + temp, beta));
            return(minorProvider.CreateTicks(range, ticks.ToArray()));
        }