HighCharts学习笔记
目录
- xAxis自定义时间刻度的显示
xAxis自定义时间刻度
我们先来看下HighCharts图表的xAxis对象有哪些属性(红色标记重要属性):
allowDecimals: Boolean
categories: Array
dateTimeLabelFormats: Object
minTickInterval: Number
offset: Number
showFirstLabel: Boolean
showLastLabel: Boolean
tickColor: Color
title
type: String
categories: Array
dateTimeLabelFormats: Object
minTickInterval: Number
offset: Number
showFirstLabel: Boolean
showLastLabel: Boolean
tickColor: Color
title
type: String
//轴线的类型。可选项:"linear","logarithmic",
"datetime"
or "category"
tickInterval: Number
//在轴线上单位刻度的间距
labels
startOnTick: Boolean
labels
startOnTick: Boolean
endOnTick: Boolean
events
events
$('#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] }] });