![](/img/trans.png)
[英]How to fix time interval on automatic slideshow when manual controls are used
[英]CanvasChartJS: how to avoid automatic time interval
我在X軸上使用帶有時間的Canvas柱形圖。
當我更新時間表時,盡管當時沒有數據,但它在圖表中顯示了常規時間間隔。
這將導致圖表中有一個空白區域,並指向最右端。
var liveData=[
{x:new Date( "Fri Jan 01 1960 " + "10:30:00" + " GMT+0530 (IST)"),
y: 20},
{x:new Date( "Fri Jan 01 1960 " + "10:35:00" + " GMT+0530 (IST)"),
y: 20},
{x:new Date( "Fri Jan 01 1960 " + "10:40:00" + " GMT+0530 (IST)"),
y: 20},
{x:new Date( "Fri Jan 01 1960 " + "11:40:00" + " GMT+0530 (IST)"),
y: 20}
]
var chart = new CanvasJS.Chart("chartContainer", {
width: 820,
hieght: 200,
title: {
text: "Live"
},
axisX: {
valueFormatString: "HH:mm:ss",
title: "Time",
gridColor: "white",
gridThickness: 0,
labelFontSize: 13
},
axisY: {
title: "Units"
},
dataPointMaxWidth: 20,
data: [{
// color: "#B0D0B0",
toolTipContent: "Time: {x} <br> Opens: <strong>{y} </strong>",
color: "#452323",
type: "column",
dataPoints: liveData
},
]
});
chart.render(); http://jsfiddle.net/1ekxfh2w/
我只想查看數據所在的時間。 我該如何實現?
或任何其他可以為我完成工作的圖表?
更改x--> label
,它將解決您的問題。 檢查這個小提琴
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.