日期格式在d3,希望有一个整数,而不是十进制 [英] date format in d3, would like to have month as an integer instead of decimal
本文介绍了日期格式在d3,希望有一个整数,而不是十进制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想要的格式为6/19而不是06/19为我的X轴。它似乎不提供这样做的方式在其官方文档:
https ://github.com/mbostock/d3/wiki/Time-Formatting
I would like to have format as 6/19 instead of 06/19 for my X axis. It does not seem to provide a way of doing so on its official documentation: https://github.com/mbostock/d3/wiki/Time-Formatting
有任何线索吗?感谢?
推荐答案
查看关于填充的部分:
指示指令的%符号后紧跟一个填充修饰符:
The % sign indicating a directive may be immediately followed by a padding modifier:
-
0
- 零填充 -
_
- space-padding -
- - 禁用填充
0
- zero-padding_
- space-padding-
- disable padding
,% - m /% - d
将禁用月和日期的填充,为6月1日给出6/1,而不是%m /%d
,其中显示06/01。
For example, "%-m/%-d"
will disable padding for both the month and date, giving you "6/1" for June 1st, as opposed to "%m/%d"
which gives "06/01".
这篇关于日期格式在d3,希望有一个整数,而不是十进制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文