Javascript Highcharts/stock xAxis仅显示年份
我正在用高价股制作一些图表 我的数据看起来像:Javascript Highcharts/stock xAxis仅显示年份,javascript,svg,highcharts,Javascript,Svg,Highcharts,我正在用高价股制作一些图表 我的数据看起来像: [1133308800, 1.95492806759836], [1135987200, 2.01739233585526], [1138665600, 2.0725059567737], [1141084800, 1.89533596472326], 以及我的xAxis设置: xAxis: { labels: { style: {
[1133308800, 1.95492806759836],
[1135987200, 2.01739233585526],
[1138665600, 2.0725059567737],
[1141084800, 1.89533596472326],
以及我的xAxis设置:
xAxis: {
labels: {
style: {
textTransform: 'uppercase',
color: '#a7b9c7',
fontFamily: 'Helvetica Neue, Helvetica',
fontSize: '11px'
}
},
lineWidth: 0,
minorGridLineWidth: 0,
lineColor: 'transparent',
minorTickLength: 0,
tickLength: 0,
plotLines: [{
color: '#3b3c40',
dashStyle: 'dot',
value: .5,
width: 1
}]
},
问题是xAxis上的标签类似于14。Jan等,我想从我的数据中得到一年
$.getJSON(name + '.json', function(data) {
seriesOptions[i] = {
name: name,
data: data,
color: colors[i]
};
seriesCounter += 1;
if (seriesCounter === names.length) {
createChart();
}
});
有人能告诉我如何在xAxis上只显示年份吗
您可以通过以下方式配置日期时间标签
{
millisecond: '%H:%M:%S.%L',
second: '%H:%M:%S',
minute: '%H:%M',
hour: '%H:%M',
day: '%e. %b',
week: '%e. %b',
month: '%b \'%y',
year: '%Y'
}