如何设置Highcharts绘图的最小开始日期



我有10/19到11/01的数据,我正在使用分散的Highcharts图绘制它(v4.1.10,无法升级(。出于某种原因,我的x轴显示为10/18,但我希望它从10/19开始。我尝试使用pointStart,但没有成功。关于如何在我的x轴上显示正确的开始日期,有什么建议吗?

Highcharts.chart('container', {
yAxis: {
gridLineWidth: 0.5,
gridLineColor: '#D6D6D6',
tickInterval: 5,
dashStyle: 'LongDash',
lineColor: '#D6D6D6'
},
xAxis: {
type: 'datetime',
dateTimeLabelFormats: {
day: '%m/%d',
week: '%d/%b',
month: '%b/%y',
year: '%Y'
},
title: {
enabled: true,
text: 'date'
},
gridLineWidth: 0,
lineColor: '#D6D6D6',
lineWidth: 0.5,
startOnTick: true
},
plotOptions: {
scatter: {
marker: {
radius: 5,
states: {
hover: {
enabled: true,
lineColor: 'rgb(100,100,100)'
}
}
},
states: {
hover: {
marker: {
enabled: false
}
}
},
tooltip: this.toolTip
}
},
chart: {
marginTop: 5,
marginRight: 0,
reflow: false,
backgroundColor: 'rgba(255, 255, 255, 0.1)',
style: {
fontFamily: 'Open Sans'
},
type: 'scatter',
spacingBottom: 0,
spacingTop: 0,
spacingLeft: 0,
spacingRight: 0
},
tooltip: {
formatter: function () {
var s = '<b>' + Highcharts.dateFormat('%m/%d %H:%M:%S', this.x) 
+ ' - ' + Highcharts.numberFormat(this.y, 2);
return s;
},
},
series: values
});

jsfiddle代码在这里

您可以设置x轴min值:

xAxis: {
min:1539950400000

示例:http://jsfiddle.net/jlbriggs/dwnx6o8e/9/

根据数据和其他选项,您可能需要查看其他属性,如startOnTicktickInterval等。

相关内容

最新更新