Example #1
0
 protected virtual void Generate(PaintArgs p, ScaleTickInfo tickInfo)
 {
     if (tickInfo.ScaleType == ScaleType.Log10)
     {
         this.GenerateLog10(p, tickInfo);
     }
     else
     {
         if (tickInfo.ScaleType == ScaleType.Linear)
         {
             this.CalculateMajorTicks(tickInfo);
         }
         this.m_MinorStepSize            = tickInfo.MinorStepSize;
         tickInfo.Display.MajorIncrement = tickInfo.MajorStepSize;
         tickInfo.Display.MinorIncrement = tickInfo.MinorStepSize;
         double num       = this.GetStartValue(tickInfo);
         double stopValue = this.GetStopValue(tickInfo);
         if (tickInfo.MinorStepSize != 0.0 && num != num + tickInfo.MinorStepSize)
         {
             while (true)
             {
                 if (Math2.InRangeDelta(num, tickInfo.Min - Math.Abs(tickInfo.Max * 1E-14), tickInfo.Max + Math.Abs(tickInfo.Max * 1E-14)))
                 {
                     tickInfo.Display.AddTickMajor(num, false);
                 }
                 if (!(num < stopValue))
                 {
                     break;
                 }
                 for (int i = 0; i < tickInfo.MinorCount; i++)
                 {
                     num += tickInfo.MinorStepSize;
                     if (Math2.InRangeDelta(num, tickInfo.Min, tickInfo.Max))
                     {
                         if (tickInfo.MidIncluded && i == tickInfo.MinorCount / 2)
                         {
                             tickInfo.Display.AddTickMid(num, false);
                         }
                         else
                         {
                             tickInfo.Display.AddTickMinor(num, false);
                         }
                     }
                 }
                 num += tickInfo.MinorStepSize;
             }
         }
         else
         {
             ScaleTickMajor scaleTickMajor = tickInfo.Display.AddTickMajor(this.Display.Range.Mid, false);
             scaleTickMajor.Value = this.Display.Range.Mid;
             scaleTickMajor.Text  = "Out of Range";
         }
     }
 }
Example #2
0
        protected void GenerateLog10(PaintArgs p, ScaleTickInfo tickInfo)
        {
            int num  = (int)Math.Log10(tickInfo.Span);
            int num2 = 1;
            int num3;

            if (num / 1 > tickInfo.MaxTicks)
            {
                if (num / num2 > tickInfo.MaxTicks)
                {
                    num2 = 1;
                }
                if (num / num2 > tickInfo.MaxTicks)
                {
                    num2 = 2;
                }
                if (num / num2 > tickInfo.MaxTicks)
                {
                    num2 = 5;
                }
                if (num / num2 > tickInfo.MaxTicks)
                {
                    num2 = 10;
                }
                if (num / num2 > tickInfo.MaxTicks)
                {
                    num2 = 20;
                }
                if (num / num2 > tickInfo.MaxTicks)
                {
                    num2 = 50;
                }
                if (num / num2 > tickInfo.MaxTicks)
                {
                    num2 = 100;
                }
                if (num / num2 > tickInfo.MaxTicks)
                {
                    num2 = 200;
                }
                if (num / num2 > tickInfo.MaxTicks)
                {
                    num2 = 200;
                }
                num3 = (int)Math.Log10(tickInfo.Min);
            }
            else
            {
                num3 = (int)Math.Log10(tickInfo.Min);
            }
            tickInfo.MajorStepSize = Math.Pow(10.0, (double)num2);
            tickInfo.MinorStepSize = tickInfo.MajorStepSize / (double)(tickInfo.MinorCount + 1);
            this.m_MinorStepSize   = tickInfo.MinorStepSize;
            double num4 = Math.Pow(10.0, (double)num3);
            double num5 = this.GetStopValue(tickInfo);

            if (!this.Display.SlidingScale)
            {
                num5 = this.Display.Range.Max;
            }
            while (true)
            {
                if (Math2.InRangeDelta(num4, tickInfo.Min, tickInfo.Max) && num4 > 0.0)
                {
                    tickInfo.Display.AddTickMajor(num4, false);
                }
                if (!(num4 < num5))
                {
                    break;
                }
                tickInfo.MinorStepSize = num4 * 10.0 / (double)(tickInfo.MinorCount + 1);
                for (int i = 1; i <= 9; i++)
                {
                    double num6 = num4 * (double)i;
                    if (!(num6 <= num5))
                    {
                        return;
                    }
                    if (Math2.InRangeDelta(num4, tickInfo.Min, tickInfo.Max) && num4 > 0.0)
                    {
                        if (tickInfo.MidIncluded && i == tickInfo.MinorCount / 2)
                        {
                            tickInfo.Display.AddTickMid(num6, false);
                        }
                        else
                        {
                            tickInfo.Display.AddTickMinor(num6, false);
                        }
                    }
                }
                num3++;
                num4 = Math.Pow(10.0, (double)num3);
            }
        }
Example #3
0
 protected override bool GetValueOnScale(double value)
 {
     return(Math2.InRangeDelta(value, base.ScaleRange.Min, base.ScaleRange.Max));
 }