UEA-PRODEM
This commit is contained in:
+11
-14
@@ -1,4 +1,4 @@
|
||||
// https://d3js.org/d3-format/ v3.1.0 Copyright 2010-2021 Mike Bostock
|
||||
// https://d3js.org/d3-format/ v3.1.2 Copyright 2010-2026 Mike Bostock
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
||||
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
||||
@@ -15,8 +15,8 @@ function formatDecimal(x) {
|
||||
// significant digits p, where x is positive and p is in [1, 21] or undefined.
|
||||
// For example, formatDecimalParts(1.23) returns ["123", 0].
|
||||
function formatDecimalParts(x, p) {
|
||||
if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e")) < 0) return null; // NaN, ±Infinity
|
||||
var i, coefficient = x.slice(0, i);
|
||||
if (!isFinite(x) || x === 0) return null; // NaN, ±Infinity, ±0
|
||||
var i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e"), coefficient = x.slice(0, i);
|
||||
|
||||
// The string returned by toExponential either has the form \d\.\d+e[-+]\d+
|
||||
// (e.g., 1.2e+3) or the form \de[-+]\d+ (e.g., 1e+3).
|
||||
@@ -121,7 +121,7 @@ var prefixExponent;
|
||||
|
||||
function formatPrefixAuto(x, p) {
|
||||
var d = formatDecimalParts(x, p);
|
||||
if (!d) return x + "";
|
||||
if (!d) return prefixExponent = undefined, x.toPrecision(p);
|
||||
var coefficient = d[0],
|
||||
exponent = d[1],
|
||||
i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1,
|
||||
@@ -175,7 +175,7 @@ function formatLocale(locale) {
|
||||
minus = locale.minus === undefined ? "−" : locale.minus + "",
|
||||
nan = locale.nan === undefined ? "NaN" : locale.nan + "";
|
||||
|
||||
function newFormat(specifier) {
|
||||
function newFormat(specifier, options) {
|
||||
specifier = formatSpecifier(specifier);
|
||||
|
||||
var fill = specifier.fill,
|
||||
@@ -200,8 +200,8 @@ function formatLocale(locale) {
|
||||
|
||||
// Compute the prefix and suffix.
|
||||
// For SI-prefix, the suffix is lazily computed.
|
||||
var prefix = symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : "",
|
||||
suffix = symbol === "$" ? currencySuffix : /[%p]/.test(type) ? percent : "";
|
||||
var prefix = (options && options.prefix !== undefined ? options.prefix : "") + (symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : ""),
|
||||
suffix = (symbol === "$" ? currencySuffix : /[%p]/.test(type) ? percent : "") + (options && options.suffix !== undefined ? options.suffix : "");
|
||||
|
||||
// What format function should we use?
|
||||
// Is this an integer type?
|
||||
@@ -242,7 +242,7 @@ function formatLocale(locale) {
|
||||
|
||||
// Compute the prefix and suffix.
|
||||
valuePrefix = (valueNegative ? (sign === "(" ? sign : minus) : sign === "-" || sign === "(" ? "" : sign) + valuePrefix;
|
||||
valueSuffix = (type === "s" ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign === "(" ? ")" : "");
|
||||
valueSuffix = (type === "s" && !isNaN(value) && prefixExponent !== undefined ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign === "(" ? ")" : "");
|
||||
|
||||
// Break the formatted value into the integer “value” part that can be
|
||||
// grouped, and fractional or exponential “suffix” part that is not.
|
||||
@@ -287,12 +287,11 @@ function formatLocale(locale) {
|
||||
}
|
||||
|
||||
function formatPrefix(specifier, value) {
|
||||
var f = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier)),
|
||||
e = Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3,
|
||||
var e = Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3,
|
||||
k = Math.pow(10, -e),
|
||||
prefix = prefixes[8 + e / 3];
|
||||
f = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier), {suffix: prefixes[8 + e / 3]});
|
||||
return function(value) {
|
||||
return f(k * value) + prefix;
|
||||
return f(k * value);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -340,6 +339,4 @@ exports.precisionFixed = precisionFixed;
|
||||
exports.precisionPrefix = precisionPrefix;
|
||||
exports.precisionRound = precisionRound;
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user