海图弄错了我的时间 [英] highcharts gets my hour time wrong
问题描述
highcharts弄错了我的时间
highcharts gets my hour time wrong
我来自委内瑞拉,以防万一.我正在做一个实时系统,我在数据库中获得的时间,秒数和毫秒数 10:39:09:2
I'm from venezuela just in case. I doing a real time system where I get in my db the time,seconds and miliseconds like 10:39:09:2
我应用strtotime($ time)然后通过json发送到图表
I apply the strtotime($time) then I sended by json to charted
在我的图表中,我进入了
and in my highcharts i got in the
xAxis: {
type: 'datetime',
title: {
text: 'Tiempo'
}
utc函数已经为假
Highcharts.setOptions({
global: {
useUTC: false
}
});
我获取json的函数是
and my function to get the json is
function requestData_Frecuencia() {
$.ajax({
url: 'Datos_Frecuencia.php',
success: function (point) {
var series = chart_Frecuencia.series[0],
shift = series.data.length > 400;
//add point
chart_Frecuencia.series[0].addPoint(eval(point), true, shift);
setTimeout(requestData_Frecuencia, 500);
},
cache: false
});
}
PS.有一段时间了,因为我用英语写,所以如果我写错了什么还不清楚,请原谅我.
PS. is been a while since I write in english so forgive me if I write something wrong o that isn't clear.
推荐答案
I found out what I was doing wrong (found the answer here ). I used to get my time in php like:
while($r2 = pg_fetch_array($sth)) {
$hora = $r2['hora'];
$Frecuencia = $r2['frecuencia'];
}
$x=strtotime($hora);
我需要乘以1000的时间.我认为是因为我需要建议日期采用毫秒形式(即整数)
I needed to multiplied by 1000 the time. I think, is because I need to suggested that date is in form of miliseconds (that is integer)
while($r2 = pg_fetch_array($sth)) {
$hora = $r2['hora'];
$Frecuencia = $r2['frecuencia'];
}
$x=strtotime($hora)*1000;
PD:无论如何,都要感谢大家的建议和回应.我真的很感激
PD: thanks to everybody anyway for the suggestion and responses given. I really appreciated
这篇关于海图弄错了我的时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!