字典翻译 问答 其它 highcharts横坐标为时间,怎么跟数据点一一对应?$(function(){$('#container').highcharts({global:{useUTC:false},xAxis:{type:'datetime',dateTimeLabelFormats:{second:'%Y:%e.%y:%e.%b:%%H:%M:%S'},categories:['2013:06:1312:12:20','2013:06:
问题标题:
highcharts横坐标为时间,怎么跟数据点一一对应?$(function(){$('#container').highcharts({global:{useUTC:false},xAxis:{type:'datetime',dateTimeLabelFormats:{second:'%Y:%e.%y:%e.%b:%%H:%M:%S'},categories:['2013:06:1312:12:20','2013:06:
问题描述:

highcharts横坐标为时间,怎么跟数据点一一对应?

$(function(){

$('#container').highcharts({

global:{

useUTC:false

},

xAxis:{

type:'datetime',

dateTimeLabelFormats:{

second:'%Y:%e.%y:%e.%b:%%H:%M:%S'

},

categories:['2013:06:1312:12:20','2013:06:1312:12:30','2013:06:1312:12:40','2013:06:1312:12:50','2013:06:1312:13:00','2013:06:1312:13:10','2013:06:1312:13:20','2013:06:1312:13:30']

},

series:[{

data:[['2013:06:1312:12:20',29.9],['2013:06:1312:12:30',71.5],['2013:06:1312:12:40',106.4],['2013:06:1312:12:50',129.2],['2013:06:1312:13:00',144.0],['2013:06:1312:13:10',176.0],['2013:06:1312:13:20',135.6],['2013:06:1312:13:30',148.5]]

//pointStart:Date.UTC(2013,0,1),

//pointInterval:10*1000//oneday

}

,{

data:[['2013:06:1312:12:50',129.2],['2013:06:1312:13:00',144.0],['2013:06:1312:13:10',176.0],['2013:06:1312:13:20',135.6],['2013:06:1312:13:30',148.5]]

//pointStart:Date.UTC(2013,0,1),

//pointInterval:10*1000//oneday

}]

});

});

通拉嘎回答:
  明显的,是你代码的问题,   categories就是表示x轴值,所以在seriesdata中没必要在设置x轴值,即   data:[29.9,71.5,106.4,129.2,144.0,176.0,135.6,148.5]   这样,data中的值和categories就一一对应了
见浪護回答:
  如果横坐标上的数据点同data:中的数据点个数一致,那么可以向你说的这么做。如果其中一条曲线个数比横坐标的点数要少,而且我也不想让它从头开始画,怎么办?
通拉嘎回答:
  这个好办,可以给没有数据的点的data值设置为null,比如:data:[null,6,11,32,110,235,369,640,1005,1436,2063,3057,4618]
点击显示
其它推荐
热门其它推荐
  • 其它