Answer the question
In order to leave comments, you need to log in
Find a formula for finding the step between values?
Hello. I'm building a chart. We need a formula that, based on the minimum and maximum values, sets the interval (step) between readings. That is, let's say that max=95; min=8; the interval in this case, approximately, should be about ~5. Or max=672; min=35; the interval in this case, approximately, should be ~50. Thank you in advance.
Answer the question
In order to leave comments, you need to log in
function calcStep($min, $max, $maxStepsQty=7) {
return ceil(($max-$min)/$maxStepsQty);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question