时间轴yAxis格式,只有分钟:秒 [英] timeline yAxis format with minutes:seconds only

查看:547
本文介绍了时间轴yAxis格式,只有分钟:秒的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



对于我使用php代码的系列数据:

  $ datetime1 = date('Y,m,d',strtotime($ performance ['PERF_DATE']。 -  1 month)); 
$ datetime2 ='Date.UTC('。$ datetime1。')';
$ chrono = strtotime($ performance ['PERF_DATE']);
$ data [] =[$ datetime2,$ chrono];

xAxis时间线适用于游泳日期:

  xAxis:{
类型:'datetime',
dateTimeLabelFormats:{
day:'%d /%m /%Y'}

yAxis时间线适用于比赛时间:

  yAxis:{
title:{text:'chronos'},
类型:'datetime',// y轴将以毫秒为单位
dateTimeLabelFormats:{//强制所有格式为分钟:秒
秒:'%M:%S',
分钟:'%M:%S'
},
min:0
}

xAxis时间轴完美运作。
但是我有一个yAxis的格式问题:我无法以mm:ss格式显示时间。



我使用mysql 5.6.4和比赛时间(PERF_TIME)存储在类型时间(2)列中,即包括2秒的小数部分。
比赛日期(PERF_DATE)存储在类型为datetime的列中。



例如,php生成的表中的$ performance ['PERF_DATE']将显示:00 :01:33.91。
但是在Highcharts中,在yAxis上,值将是16.Jan,并且在标签上它将显示值1371333600.我想那些是微秒。
我假设我需要在$ chrono = strtotime($ performance ['PERF_DATE'])上应用正确的时间格式函数;
有人可以帮助我吗?
非常感谢。

解决方案

您可以显示您的数据输出?对我来说,它工作正常,请参阅: http://jsfiddle.net/Fusher/pQ5EC/12/确保您的y值也是以毫秒为单位的时间戳。

  $('#container')。highcharts({

图表:{
请输入:'column'
},

xAxis:{
类型:'datetime'
},

y轴:{
类型:'datetime'
},


系列:[{
名称:'Temperatures',
pointStart:new Date()。 getTime(),
pointInterval:24 * 3600 * 1000,
data:[1.5 * 60 * 1000,1.2 * 60 * 1000,2.5 * 60 * 1000,1.9 * 60 * 1000,],
}]

});


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.

    $('#container').highcharts({

        chart: {
            type: 'column'
        },

        xAxis: {
            type: 'datetime'
        },

        yAxis: {
            type: 'datetime'
        },


        series: [{
            name: 'Temperatures',
            pointStart: new Date().getTime(),
            pointInterval: 24 * 3600 * 1000, 
            data: [1.5 * 60 * 1000,1.2 * 60 * 1000,2.5 * 60 * 1000,1.9 * 60 * 1000,],
        }]

    }); 

这篇关于时间轴yAxis格式,只有分钟:秒的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆