Esempio n. 1
0
        private string GetRoundedValue(double min, double max, double value)
        {
            double roundedValue = value;
            var log = RoundingHelper.GetDifferenceLog(min, max);
            string format = "G3";
            double diff = Math.Abs(max - min);
            if (1E3 < diff && diff < 1E6)
            {
                format = "F0";
            }
            if (log < 0)
                format = "G" + (-log + 2).ToString();

            return roundedValue.ToString(format);
        }
Esempio n. 2
0
        public ITicksInfo <double> GetTicks(Range <double> range, int ticksCount)
        {
            double min = LogByBase(range.Min);
            double max = LogByBase(range.Max);

            double minDown = Math.Floor(min);
            double maxUp   = Math.Ceiling(max);

            double logLength = LogByBase(range.GetLength());

            ticks = CreateTicks(range);

            int log = RoundingHelper.GetDifferenceLog(range.Min, range.Max);
            TicksInfo <double> result = new TicksInfo <double> {
                Ticks = ticks, TickSizes = ArrayExtensions.CreateArray(ticks.Length, 1.0), Info = log
            };

            return(result);
        }
        public ITicksInfo <double> GetTicks(Range <double> range, int ticksCount)
        {
            double min = LogByBase(range.Min);
            double max = LogByBase(range.Max);

            double minDown = Math.Floor(min);
            double maxUp   = Math.Ceiling(max);

            double logLength = LogByBase(range.GetLength());

            // JCS TODO Create a range that hold the number of tick counts. The range created is always
            // powers of logBase,could pad it out
            ticks = CreateTicks(range);            //.Concat(new double[] { 0.02, 0.04, 0.06, 0.08, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9 }).OrderBy(x => x).ToArray();

            int log = RoundingHelper.GetDifferenceLog(range.Min, range.Max);
            TicksInfo <double> result = new TicksInfo <double> {
                Ticks = ticks, TickSizes = ArrayExtensions.CreateArray(ticks.Length, 1.0), Info = log
            };

            return(result);
        }