Hi
any idea what formula is used by NumericYAxis to calculate auto interval?
Regards,
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.
Factor * 10 ^ Log10(x) where x = max - min
will not result in interval value of 200 please check.
Hi Mudassir,
I've rechecked the algorithm and it seems you are right about this. Good catch! It's my mistake typing it that way.
What actually happens in the algorithm, is this:
Factor * 10 ^ (Lowest integer value bigger than (Log10(x))
I've missed that and this is the thing that makes the interval in a nice rounded number (like 200).
Thanks,
Martin Stoev
I've provided you with the basic idea of the algorithm. If you wish to see the exact implementation, I'll gladly navigate you through the source code of the control. In order to get the source code you can read this topic. You can find what you need to do in order to get it. After that, I can guide you where exactly is the implementation of that logic.
Hi again!
i guess you didn't answer the question yet, you give the hint but didn't tell the exact interval calculation
i am still struggling to calculate interval.
Hello again Mudassir,
If you have any other questions about this matter, please don't hesitate to ask.
Yes, there might be some cases in my explanation, where it will be different from the actual algorithm. The reason is because I can provide you with the basic idea.
Thank you for your understanding,
Well even this is not the accurate solution.
change series and the results will be exploded.
anyhow thanks for the efforts you made.