我在 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
},
]
});
图表.render(); http://jsfiddle.net/1ekxfh2w/
我只想查看有数据的时间。我怎样才能做到这一点?
或者任何其他可以为我完成这项工作的图表?