【发布时间】:2017-09-20 04:16:44
【问题描述】:
是否可以使用 tickformat 向 xaxis 和 yaxis 刻度添加格式?
想法是将轴的长名称切割为:
axiswithaverylongname --> axisw...
在 plotly api 参考中有格式化日期的示例 https://plot.ly/javascript/reference/#layout-xaxis-tickformat
他们还参考了 d3 文档 https://github.com/d3/d3-format/blob/master/README.md
来自情节参考:
tickformat (string)
default: ""
Sets the tick label formatting rule using d3 formatting mini-languages
which are very similar to those in Python. For numbers, see:
https://github.com/d3/d3-format/blob/master/README.md#locale_format
And for dates see: https://github.com/d3/d3-time-
format/blob/master/README.md#locale_format We add one item to d3's
date formatter: "%{n}f" for fractional seconds with n digits. For
example, "2016-10-13 09:15:23.456" with tickformat "%H~%M~%S.%2f"
would display "09~15~23.46"
【问题讨论】:
标签: javascript d3.js plotly