javascript - How to show decimal numbers in d3 radialProgress? -


im using d3 component radialprogress.js

but not possible show decimal numbers, example:

1.37% shows 1%.

is there configuration can change it?

thanks.

[edit]

i found function:

function labeltween(a) {     var = d3.interpolate(_currentvalue, a);     _currentvalue = i(0);      return function(t) {         _currentvalue = i(t);         this.textcontent = math.round(i(t)) + "%";     } } 

wich used by:

 label.transition().duration(_duration)                 .tween("text",labeltween); 

the a parameter in labeltween function value on label text. value rounded when labeltween function called.

this not configurable, value rounded in code. need replace

.text(function (d) { return math.round((_value-_minvalue)/(_maxvalue-_minvalue)*100) + "%" }) 

with

.text(function (d) { return (_value-_minvalue)/(_maxvalue-_minvalue)*100 + "%" }) 

to disable rounding. there few other places needs happen well:

label.datum(math.round(ratio*100)); 

should be

label.datum(ratio*100); 

and

this.textcontent = math.round(i(t)) + "%"; 

should be

this.textcontent = i(t) + "%"; 

Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -