I’m working on a chart that has min -512 and max 512. The y axis data needs to be auto adjust binary interval, not fixed.
Currently, I have to manually add this section below to the min.js file to get what i need. Can you add a similar functionality to your source?:
//C.getNiceNumber = function (a, b) { //original
C.getNiceNumber = function (a, b, bin) { //custom binary
if (bin) { //custom binary
return C.getNiceNumberBinary(a, b); //custom binary
} else {
//original, base 10 calculation
…
}
};
/* custom binary check:START */
C.getNiceNumberBinary = function (a, b) {
var n = Math.floor(Math.log(a) / Math.LN2);
var r = a / Math.pow(2, n);
var i;
if (b) {
if (r < 1.5) i = 1;
else if (r < 3) i = 2;
else if (r < 7) i = 4;
else i = 8;
} else {
if (r <= 1) i = 1;
else if (r <= 2) i = 2;
else if (r <= 5) i = 4;
else i = 8;
}
var interval = i * Math.pow(2, n);
return interval;
};
/* custom binary check:END */