Sha256: d0d4c95d6842aa63456f02097e52ab10b2d00bfcd6c3956bd000cbd694406648

Contents?: true

Size: 602 Bytes

Versions: 25

Compression:

Stored size: 602 Bytes

Contents

var d3_formatPrefixes = ["y","z","a","f","p","n","μ","m","","k","M","G","T","P","E","Z","Y"].map(d3_formatPrefix);

d3.formatPrefix = function(value, precision) {
  var i = 0;
  if (value) {
    if (value < 0) value *= -1;
    if (precision) value = d3.round(value, d3_format_precision(value, precision));
    i = 1 + Math.floor(1e-12 + Math.log(value) / Math.LN10);
    i = Math.max(-24, Math.min(24, Math.floor((i <= 0 ? i + 1 : i - 1) / 3) * 3));
  }
  return d3_formatPrefixes[8 + i / 3];
};

function d3_formatPrefix(d, i) {
  return {
    scale: Math.pow(10, (8 - i) * 3),
    symbol: d
  };
}

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
picky-statistics-4.0.2 lib/picky-statistics/application/javascripts/d3/src/core/formatPrefix.js
picky-statistics-4.0.1 lib/picky-statistics/application/javascripts/d3/src/core/formatPrefix.js
picky-statistics-4.0.0 lib/picky-statistics/application/javascripts/d3/src/core/formatPrefix.js
picky-statistics-4.0.0pre6 lib/picky-statistics/application/javascripts/d3/src/core/formatPrefix.js
picky-statistics-4.0.0pre5 lib/picky-statistics/application/javascripts/d3/src/core/formatPrefix.js