jQuery UI Widgets Forums Chart Default decimal places

This topic contains 2 replies, has 2 voices, and was last updated by  PiDome 11 years, 1 month ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • Default decimal places #52491

    PiDome
    Participant

    Hi All,

    I’m using a base class to show graphs in a mixed value environment. The default setting for decimal places is set to two. What happens is that when there are no decimal places is that the value on the y axis does not show the “.00” behind a whole number, but when there are it shows “.23”, which is correct in my case of the usage of the graphs.

    But, when i use formatSettings: {decimalPlaces: 3} the above mentioned behaviour does not apply anymore and whole values on the y axis are showing “.000” behind a whole number.

    Should i use a custom formatter or am i using an incorrect setting?

    Best regards,
    John.

    Default decimal places #52555

    Dimitar
    Participant

    Hello John,

    The default decimalPlaces (not set), which trims “.00” is not the same as decimalPlaces: 2, which retains them. We recommend you to use formatFunction to be able to modify the displayed value however you wish, e.g.:

    { dataField: 'Debt', displayText: 'Debt per Capita', showLabels: true, showLabels: true, formatFunction: function (value, a, b, c) {
        var float = parseFloat(value);
        var int = parseInt(value);
        if (float == int) {
            return int;
        } else {
            return float.toFixed(3);
        };
    }
    }

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

    Default decimal places #52593

    PiDome
    Participant

    Hi Dimitar,

    Maybe i’ve overlooked it but this explains the usage of decimalPlaces. Thank you for your response and example.

    Best regards,
    John.

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

You must be logged in to reply to this topic.