Skip to content

Decimal separator for bars in Chart Grid mode #254

Description

@fdaudens

Hi,

I'd like to use a comma for decimal separators in the Chart Grid renderer. Do you know which line I should modify?

capture d ecran 2016-11-21 a 18 58 48

I've already configured helper.js for the XYRenderer.jsx with the following code, but can't find what to change in ChartGridRenderer.jsk:

function round_to_precision(num, precision, supress_thou_sep) {
    if (num === 0) {
        //zero should always be "0"
        return "0";
    }

    var s = Math.round(num * Math.pow(10,precision)) / Math.pow(10,precision);
    s = s + "";

    s = s.split(".");

    if (s.length == 1) {
        s[1] = "";
    }

    if (s[1].length < precision) {
        s[1] += Array(precision-s[1].length + 1).join("0");
    }

    if (s[0].length > 4) {
        s[0] = d3.format(",")(parseInt(s[0]));
        s[0] = s[0]+"";
        s[0] = s[0].replace(/,/g, " ");
    }

    if (precision === 0) {
        return s[0];
    }

    return s.join(",");
}

Thank you!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions