Home Forums Chart Support How to reduce number of 0 on Y axis?

How to reduce number of 0 on Y axis?

Viewing 3 posts - 1 through 3 (of 3 total)
  • #29028

    Good afternoon,

    I am displaying data from the database onto the graph. Values that I am plotting on Y axis are Watts. The small problem is that on the graph, my Y values are like this:


    So my question is, is there a function, which would allow me to replace those extra 0s’ into something like this:

    600T Watts
    500T Watts
    400T Watts

    I do apologies if this question was already asked, I have tried finding this answer here already, but I couldn’t find anything similar.

    Thank you kindly in advance.
    Best wishes,


    Please Ignore this. It has been resolved using this function:

    function addSymbols(e) {
                    var suffixes = ["", "K", "M", "B"];
                    var order = Math.max(Math.floor(Math.log(Math.abs(e.value)) / Math.log(1000)), 0);
                    if (order > suffixes.length - 1)
                        order = suffixes.length - 1;
                    var suffix = suffixes[order];
                    return CanvasJS.formatNumber(e.value / Math.pow(1000, order)) + suffix;

    and declaring it in Y axis.

    Thank you.



    Glad that you figured it out :)

    Vishwas R
    Team CanvasJS

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

You must be logged in to reply to this topic.