Home forums Feature Requests & Feedback Binary Interval on Y Axis

This topic contains 1 reply, has 2 voices, and was last updated by  Sanjoy 6 months, 2 weeks ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #10532

    pborunda
    Member

    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 */

    #10552

    Sanjoy
    Moderator

    Hi,

    Thanks for sharing your view. Binary Interval is not in out roadmap yet. But we will consider it in future.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.