簡體   English   中英

chart.js v2-使用時間刻度時如何“填充”圖形

[英]chart.js v2 - how to 'fill' the graph when using time scale

我用chart.js v2創建了一個圖表,並且我有一個很好的使用時間刻度軸的工作圖。 現在,我想在軸上顯示整個小時數,因此我將選項設置為:

xAxes: [{
    type: 'time',
    time: {
        unit: 'hour',
        unitStepSize: 1,
        displayFormats: { 'hour': 'H:mm' }
    }
}]

這很好用,但是在圖表的開始和結尾都有空白。 在此處輸入圖片說明

我該如何使其適合: 在此處輸入圖片說明

Codepen: http ://codepen.io/WilbertE/pen/wzRmWr

您要使用time屬性的minmax屬性:

options: {
    scales: {
        xAxes: [{
            type: "time",
            time: {
                min: /* Set your min here .. */,
                max: /* .. and your max here*/
            }
        }]
    }
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM