youcef92 / flotr

Automatically exported from code.google.com/p/flotr
0 stars 0 forks source link

Add disk mode for axis to label tick with GB, MB, KB, and B #89

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Similar to how mode: 'date' can be specified for an axis, you should also be 
able to specify an axis 
to be a data, storage, disk (whichever you want to call it) mode, so that the 
tick marks will be 
converted into more readable data amounts of Gigabyte (GB), Megabyte (MB), 
Kilobyte(KB), and Byte 
(B). Attached is a patch to include this support.

Original issue reported on code.google.com by unilo...@gmail.com on 12 Sep 2009 at 5:14

Attachments:

GoogleCodeExporter commented 8 years ago
Hello, that's what the function Flotr.engineeringNotation is for !
I don't think it deserves it's own mode, that's why I made this utility 
function, you 
can use it like this :

axis.tickFormatter = function(v) {
  return Flotr. engineeringNotation(v, 2, 1024)+'B';
}

The second argument is the precision, and the third is the base (1024 = 1kB);

Original comment by fabien.menager on 12 Sep 2009 at 9:25