HighCharts学习笔记

目录

  • xAxis自定义时间刻度的显示

 

xAxis自定义时间刻度

我们先来看下HighCharts图表的xAxis对象有哪些属性(红色标记重要属性):
allowDecimals: Boolean
categories: Array
dateTimeLabelFormats: Object
minTickInterval: Number
offset: Number
showFirstLabel: Boolean
showLastLabel: Boolean
tickColor: Color
title
typeString
//轴线的类型。可选项:"linear"," logarithmic", "datetime"  or  "category"
tickIntervalNumber
//在轴线上单位刻度的间距
labels
startOnTickBoolean
endOnTickBoolean
events
 
详细参考:
 
1)在X轴显示例01-01的时间刻度
$('#container').highcharts({
	xAxis: {
		type: 'datetime',
		labels: {
			formatter: function () {
				return Highcharts.dateFormat('%m-%d ', this.value);
			}
		},
		startOnTick: true,
		endOnTick: true,
	},
	series: [{
		pointStart: Date.UTC(2014, 1, 1), //JS时间戳 1388534400000
		data: [29.9, 19.9, 42.9, 20.9]
	}]
});

HighCharts学习笔记_第1张图片

你可能感兴趣的:(Highcharts)