在 highcharts 上显示日期和时间

Display Date and time on highcharts

我有以下数据

firstData = [  
["2019-11-24", "12:38:54"],
 ["2019-11-21", "07:06:29"],
 ["2019-11-20", "19:26:37"],
 ["2019-09-26", "19:56:00"] ]

secondData = [ 
["2019-09-26", "10:26:00"],
 ["2019-11-20", "06:52:34"],
 ["2019-11-21", "07:06:19"],
 ["2019-11-24", "07:38:54"] ]

我想显示这样的图表。 date and time graph

所以正如我在评论中提到的,y 值必须是一个数字。如果您想将其呈现为时间格式,则需要将此字符串转换为适当的数字,请检查下面的函数和演示:https://jsfiddle.net/BlackLabel/2vc7aphd/1/

function parseToNumber(string) {
  return Date.parse("1-1-1 " + string) - Date.parse('1-1-1 00:00:00')
}

function parseData(data) {
  let output = [];
  data.forEach(d => {
    let x = d[0],
      y = d[1];

    output.push({
      name: x,
      y: parseToNumber(y),
      label: y
    });
  })
  return output;
}