I want to chart (line) a swimmer competition times over several meets.
For the series data I use the php code :
$datetime1=date('Y, m, d', strtotime($performances['PERF_DATE']."-1 month"));
$datetime2='Date.UTC('.$datetime1.')';
$chrono=strtotime($performances['PERF_DATE']);
$data[] = "[$datetime2, $chrono]";
The xAxis timeline is for swim meet dates :
xAxis: {
type: 'datetime',
dateTimeLabelFormats: {
day: '%d/%m/%Y'}
The yAxis timeline is for the race times :
yAxis: {
title : { text :'chronos'},
type: 'datetime', //y-axis will be in milliseconds
dateTimeLabelFormats: { //force all formats to be minute:second
second: '%M:%S',
minute: '%M:%S'
},
min: 0
}
The xAxis timeline works perfectly. But I have a format issue with the yAxis: I cannot display the times in mm:ss format.
I'm using mysql 5.6.4 and the race times (PERF_TIME) are stored in type time(2) column , i.e. including 2 fractions of a second. Race dates (PERF_DATE) are stored in type datetime column.
For example, $performances['PERF_DATE'] in a php generated table will display : 00:01:33.91. But in Highcharts, on the yAxis, the value will be 16.Jan, and on the plot label it will show the value 1371333600. I guess those are microseconds. I assume I need to apply the correct time format function on $chrono=strtotime($performances['PERF_DATE']); Can someone help me with this ? Thanks a lot.
Could you show your
data
output? For me it works fine, see: http://jsfiddle.net/Fusher/pQ5EC/12/ Make sure, your y-values are timestamps in milliseconds too.Apologies, I did respond earlier but my answer was not saved by the system --- apparently there's an 8 hour black-out period where the author cannot answer his own question.
I figured it out: my times are formated hh:mm:ss.00 in mysql. I thgouht there was a function to easily convert mysql time format into milliseconds format, but apparently there's none. So I manually "explode" the time into milliseconds, using the code:
Maybe there's a cleaner way? But I can now feed $data to Highcharts and it works perfectly.
Thanks.