Php 时间戳格式化Highcharts数据表

Php 时间戳格式化Highcharts数据表,php,highcharts,Php,Highcharts,我以毫秒精度在Highcharts中绘制timeseries数据,它工作正常,但是当我打开数据表时,它使用了不同的时间格式: 有没有办法在表中显示毫秒?谢谢。不幸的是,Highcharts没有在数据表中以毫秒(时间戳)为单位显示数据的默认选项。但是,可以通过包装Highcharts.Chart.prototype.getDataRows方法并映射用于绘制表的数据数组来轻松完成 包装器代码: (function(H) { H.wrap(H.Chart.prototype, 'getDataR

我以毫秒精度在Highcharts中绘制timeseries数据,它工作正常,但是当我打开数据表时,它使用了不同的时间格式:


有没有办法在表中显示毫秒?谢谢。

不幸的是,Highcharts没有在数据表中以毫秒(时间戳)为单位显示数据的默认选项。但是,可以通过包装
Highcharts.Chart.prototype.getDataRows
方法并映射用于绘制表的数据数组来轻松完成

包装器代码:

(function(H) {
  H.wrap(H.Chart.prototype, 'getDataRows', function(proceed, multiLevelHeaders) {
    var rows = proceed.call(this, multiLevelHeaders);
    rows = rows.map(row => {
      if (row.x) {
        row[0] = H.dateFormat('%Y-%m-%y %H:%M:%S.%L', row.x);
      }
      return row;
    });

    return rows;
  });
}(Highcharts));
演示:

(function(H) {
  H.wrap(H.Chart.prototype, 'getDataRows', function(proceed, multiLevelHeaders) {
    var rows = proceed.call(this, multiLevelHeaders);
    rows = rows.map(row => {
      if (row.x) {
        row[0] = H.dateFormat('%Y-%m-%y %H:%M:%S.%L', row.x);
      }
      return row;
    });

    return rows;
  });
}(Highcharts));