gpt4 book ai didi

javascript - 如何对 d3 json 中的数字应用多种格式

转载 作者:行者123 更新时间:2023-11-28 00:27:28 24 4
gpt4 key购买 nike

我正在尝试得到类似的东西

12,345.6

如果我使用 d3 就有格式化功能

d3.format(".1f") 我会得到 12345.6

但是如果我使用

d3.format("0,000") 我会得到 12,345.600000000000

最佳答案

没关系,我已经弄清楚了

d3.format(",.1f")

以防万一有人需要它。

关于javascript - 如何对 d3 json 中的数字应用多种格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29346516/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com