Dojo charts -0.00 on y-axis issue and fix

I have found that sometimes Dojo charts displays the -0.00 on the y-axis.

Dojo -0.0 on y-axis

Dojo -0.0 on y-axis

 

 

 

 

 
 

The workaround is to pass your own axis label formatting function.

    var yAxisLblFunc = function(text, value, precision){
        var n = Number(text);	
        return n.toFixed(2);
    };    
 
    chart.addAxis("y", {
          // ... other setup params
          labelFunc: yAxisLblFunc
    });

This way you can format the label any way you like.

Dojo -0.0 workaround

Dojo -0.0 workaround

 

 

 

 

 
 

See this jsfiddle for an example.

admin

Chris Tran is a Software Business Manager from Brisbane, Australia. When he's not enjoying time with his family, he works with some very talented people at KoBold Group Pty Ltd.

More Posts

Follow Me:
TwitterFacebookLinkedInGoogle PlusFlickrYouTube

Comments