Avoid race condition for interval/intervalMagnitude
https://github.com/danielgindi/Charts/pull/2377
This commit is contained in:
parent
2e725e49d3
commit
3f5475077e
2 changed files with 11 additions and 6 deletions
|
@ -174,9 +174,12 @@ public abstract class AxisRenderer extends Renderer {
|
|||
double intervalMagnitude = Utils.roundToNextSignificant(Math.pow(10, (int) Math.log10(interval)));
|
||||
int intervalSigDigit = (int) (interval / intervalMagnitude);
|
||||
if (intervalSigDigit > 5) {
|
||||
// Use one order of magnitude higher, to avoid intervals like 0.9 or
|
||||
// 90
|
||||
interval = Math.floor(10 * intervalMagnitude);
|
||||
// Use one order of magnitude higher, to avoid intervals like 0.9 or 90
|
||||
// if it's 0.0 after floor(), we use the old value
|
||||
interval = Math.floor(10.0 * intervalMagnitude) == 0.0
|
||||
? interval
|
||||
: Math.floor(10.0 * intervalMagnitude);
|
||||
|
||||
}
|
||||
|
||||
int n = mAxis.isCenterAxisLabelsEnabled() ? 1 : 0;
|
||||
|
|
|
@ -52,9 +52,11 @@ public class YAxisRendererRadarChart extends YAxisRenderer {
|
|||
double intervalMagnitude = Utils.roundToNextSignificant(Math.pow(10, (int) Math.log10(interval)));
|
||||
int intervalSigDigit = (int) (interval / intervalMagnitude);
|
||||
if (intervalSigDigit > 5) {
|
||||
// Use one order of magnitude higher, to avoid intervals like 0.9 or
|
||||
// 90
|
||||
interval = Math.floor(10 * intervalMagnitude);
|
||||
// Use one order of magnitude higher, to avoid intervals like 0.9 or 90
|
||||
// if it's 0.0 after floor(), we use the old value
|
||||
interval = Math.floor(10.0 * intervalMagnitude) == 0.0
|
||||
? interval
|
||||
: Math.floor(10.0 * intervalMagnitude);
|
||||
}
|
||||
|
||||
boolean centeringEnabled = mAxis.isCenterAxisLabelsEnabled();
|
||||
|
|
Loading…
Add table
Reference in a new issue