[英]Highcharts showing timestamp as wrong date
I need to show correct date on highcharts based on timestamp, 我需要根据时间戳在高图上显示正确的日期,
Config as follows, 配置如下,
series: [{
"name": "avg_sales",
"color": "#3b6982",
"data": [{
"name": 1230768000,
"y": 526.4200000000001
}, {
"name": 1230854400,
"y": 1850.3116666666667
}, {
"name": 1230940800,
"y": 3199.786
}]
}],
tooltip: {
dateTimeLabelFormats: {
hour: '%A, %b %e, %l %p'
},
},
xAxis: {
dateTimeLabelFormats: {
hour: '%A, %b %e, %l %p'
},
type: 'datetime'
}
EXPECTED OUTPUT: it shows correct values in tooltip but not in the x axis values. 预期输出:它在工具提示中显示正确的值,但在x轴值中未显示。 how to sort this issue?
如何解决这个问题?
If you use timestamp or number, use x property instead of name (name can be still used though but x takes precedence) 如果您使用时间戳或数字,请使用x属性代替名称(尽管仍可以使用名称,但x优先)
"data": [{
"name": "point's name",
"x": 1230768000,
"y": 526.4200000000001
}, {
"x": 1230854400,
"y": 1850.3116666666667
}, {
"x": 1230940800,
"y": 3199.786
}]
example: http://jsfiddle.net/95LX7/71/ 例如: http : //jsfiddle.net/95LX7/71/
One way is to change data format to following as what shown in highchart official example 一种方法是将数据格式更改为highchart官方示例中所示的格式
"data": [
[1230768000, 526.4200000000001],
[1230854400, 1850.3116666666667],
[1230940800, 3199.786]
]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.