2014-03-30 50 views
1

我需要更改背景標籤Elessar,有誰知道更改默認值的參數? 它實際上顯示格式爲YYYY-MM-DD HH:mm,我只需要HH:mm配置背景標籤

+0

能告訴你你現在有什麼? –

+0

如果我設置參數bgLabels:4,出現背景標籤(在這種情況下爲4),但格式爲YYYY-MM-DD HH:SS – esteban

回答

1

從版本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'); 
    } 
} 
+0

我只想補充一點,看起來項目的GitHub頁面上的API描述是不正確,實際屬性名稱是'bgMark',而不是複數'bgMarks'。您可以在https://github.com/quarterto/Elessar/blob/develop/dist/elessar.js#L506上的源代碼中自行查看 –