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 Grgich-Tran is a Development Manager from Brisbane, Australia. When he's not dad-ing it up, he works with some very talented people.

More Posts

Follow Me:
TwitterFacebookLinkedInGoogle PlusFlickrYouTube

Comments