Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
455
How xamdatachart calculates interval on NumericYaxis?
posted

Hi

any idea what formula is used by NumericYAxis to calculate auto interval?

Regards,

Parents
  • 775
    posted

    Hello Mudassir,

                    I’ve been looking into the algorithm which calculates the auto interval for the NumericYAxis, and found out that there are several steps in order to measure the auto interval. I’ll walk you through all of them, so you can understand each one.

         1. The first step is to determine the minimum and maximum values of the data. Let’s say that those values are 100 and 1480.

         2. Then, the difference from those values (1480 – 100 = 1380) is used in the following formula:

    A = x / 10 ^ Log10(x),

    where “x” is equal to the difference between the maximum and minimum values. In the case where x = 1380, the value A = 1.38.

         3. The next step is to calculate the factor which will determine the calculated interval. That factor is based on the value “A” and it will always be produced as an integer value. In the case where A = 1.38, the factor will be 2.

         4. After we calculated the factor we can calculate the actual interval’s value:

    Interval = Factor * 10 ^ Log10(x)

    In the case where the factor is equal to 2, the interval = 200.

         5. At step 4, we already have the interval calculated. There is still one more step to do. That’s to determine the lower and upper limit of the chart’s plot area. The formulas for those values are:

    Lower value = biggest integer value of smaller than (minimum value / interval) * Interval

    Upper value = smallest integer value of bigger than (maximum value / interval) * Interval

                   

    Thank you for your post, and if you have some more questions about this, don’t hesitate to ask.

Reply Children