0

请您帮我更改 angular nvd3 yAxis2 中的显示。事实上,我正在尝试将显示从例如从 9000 更改为 9K。我知道这可能是可以使用d3.formatPrefix(".1", 1e6)但我无法做到的。这是一个plunker

4

1 回答 1

1

你不需要使用 d3.formatPrefix(".1", 1e6)。您已经在使用更正的格式d3.format(',.2f')(d),只需按照 d3 github 站点中的说明更改fwiths

The available type values are:

e - exponent notation.
f - fixed point notation.
g - either decimal or exponent notation, rounded to significant digits.
r - decimal notation, rounded to significant digits.
s - decimal notation with an SI prefix, rounded to significant digits.
% - multiply by 100, and then decimal notation with a percent sign.
p - multiply by 100, round to significant digits, and then decimal notation with a percent sign.
b - binary notation, rounded to integer.
o - octal notation, rounded to integer.
d - decimal notation, rounded to integer.
x - hexadecimal notation, using lower-case letters, rounded to integer.
X - hexadecimal notation, using upper-case letters, rounded to integer.
c - converts the integer to the corresponding unicode character before printing.

(none) - like g, but trim insignificant trailing zeros.
于 2016-08-18T15:13:22.747 回答