我需要在 Elessar 中更改背景标签,有谁知道更改默认值的参数?它实际上是以YYYY-MM-DD HH:mm
格式显示的,我只需要HH:mm
。
从版本 1.7 开始,有一个新的bgMarks
选项:
bgMarks: {
count: 0, // number of value labels to write in the background of the bar
interval: Infinity, // provide instead of count to specify the space between labels
label: id // string or function to write as the text of a label. functions are called with normalised values.
}
对于您的用例,您需要(假设您使用的是 Moment.js):
bgMarks: {
count: 4,
label: function(val) {
return moment(val).format('HH:mm');
}
}