簡體   English   中英

CanvasJS和毫秒時間X軸

[英]CanvasJS and millisecond time X Axis

我創建了這個小提琴: 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軸,繪圖都一團糟。

我用的是微秒,而不是毫秒。 因此,這只是第6個參數使用1/1000而不是1/1000000的情況。

{x: new Date(Date.UTC (2015, 05, 13, 11, 40, 26, 594) ), y: 26 },

暫無
暫無

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

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