我创造了这个小提琴:http://jsfiddle.net/jymxu523/4/
var chart = new CanvasJS.Chart("chartContainer",
{
title:{
text: "Converting in Local Time"
},
axisX:{
title: "time",
gridThickness: 2,
interval:1,
// hangs on safari at least if I try uncomment this
//intervalType: "millisecond",
valueFormatString: "HH:mm fff ",
labelAngle: -20
},
axisY:{
title: "distance"
},
data: [
{
type: "line",
dataPoints: [//array timestamps with millis
{x: new Date(Date.UTC (2015, 05, 13, 11, 40, 26, 594730) ), y: 26 },
{x: new Date( Date.UTC (2015, 05, 13, 11, 40, 26, 798973) ), y: 38 },
{x: new Date( Date.UTC(2015, 05, 13, 11, 40, 27, 004165) ), y: 43 },
{x: new Date( Date.UTC(2015, 05, 13, 11, 40, 27, 209837) ), y: 29},
{x: new Date( Date.UTC(2015, 05, 13, 11, 40, 27, 417610) ), y: 41}
]
}
]
});
chart.render();
似乎我无法让canvasJS以毫秒精度绘制。我有小时,分钟,秒和毫秒的情节数据。但无论我如何尝试格式化X轴,绘图都会搞砸。
答案 0 :(得分:0)
我使用的是微秒,而不是毫秒。所以这只是第6个参数使用1/1000而不是1/1000000的情况。
{x: new Date(Date.UTC (2015, 05, 13, 11, 40, 26, 594) ), y: 26 },