Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/oop/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在highcharts的工具提示中转换日期格式的时间戳?_Highcharts - Fatal编程技术网

如何在highcharts的工具提示中转换日期格式的时间戳?

如何在highcharts的工具提示中转换日期格式的时间戳?,highcharts,Highcharts,在这里,我在react项目中使用了线条高度图,在我的线条高度图中,我显示工具提示,在这个工具时间中,我有一个日期,但这个日期是时间戳格式的,我想在工具提示中以日期格式显示这个时间戳在高度图工具提示中如何可能 tooltip: { headerFormat: '<b>{series.name}</b>', pointFormat: '{point.x}', // 1554422400 }, 工具提示:{ headerFormat:“{series.

在这里,我在react项目中使用了线条高度图,在我的线条高度图中,我显示工具提示,在这个工具时间中,我有一个日期,但这个日期是时间戳格式的,我想在工具提示中以日期格式显示这个时间戳在高度图工具提示中如何可能

 tooltip: {
    headerFormat: '<b>{series.name}</b>',
    pointFormat: '{point.x}',  // 1554422400
  },
工具提示:{
headerFormat:“{series.name}”,
pointFormat:'{point.x}',//1554422400
},

pointFormatter
函数中,您可以使用Highcharts
dateFormat
方法:

tooltip: {
    ...,
    pointFormatter: function() {
        return Highcharts.dateFormat('%a %d %b %H:%M:%S', this.x)
    }
}
现场演示:

API参考:


pointFormatter
函数中,您可以使用Highcharts
dateFormat
方法:

tooltip: {
    ...,
    pointFormatter: function() {
        return Highcharts.dateFormat('%a %d %b %H:%M:%S', this.x)
    }
}
现场演示:

API参考:


使用moment.js npm,专用于时间以及日期和时间的所有相关格式

使用moment.js npm,专用于时间以及日期和时间的所有相关格式

问题的可能重复@tarzenchugh的可能重复我尝试了该答案的解决方案,但显示了相同的日期(1970年1月18日)如果我有不同的时间戳,@tarzenchugh的可能重复的问题,@tarzenchugh的可能重复我尝试了这个答案的解决方案,但它显示了相同的日期(1970年1月18日)。如果我有不同的时间戳,则显示相同的日期。@DDD,是的,因为我的时间戳如下:
[0,1,2,3,4,…]
。检查这个例子:Hi@DDD,是的,因为我的时间戳看起来像这样:
[0,1,2,3,4,…]
。检查此示例: