带有按月(如一月、二月、三月)时间戳分组的数据,并在 Highcharts 中显示为该月的总计数
Data with timestamp group to month(like Jan, Feb, March) and showing as total count for month in Highcharts
使用 Highcharts,是否可以按月绘制柱形图(如一月、二月、三月),作为数据,我有时间戳,但无法将数据分组到每个月的列。
http://jsfiddle.net/k6onhj2xenter code here
xAxis: {
type: 'datetime',
dateTimeLabelFormats: { // don't display the dummy year
month: '%e. %b',
year: '%b'
},
title: {
text: 'Date'
}
}
这里的图表是按时间戳显示的,但我想将其转换为按月显示。
在Highcharts
中不可能,但在Highstock
中可以。有选项 dataGrouping 可以放在 plotOptions
:
plotOptions: {
column: {
dataGrouping: {
forced: true,
units: [['month', [1]]]
}
}
}
这将强制图表每 1 个月对数据进行分组。
但是使用 Highstock 会改变你的大部分选项,你可以改回来。
这是更改所有选项后的样子:jsfiddle
正如我所说,您必须更改很多选项才能使其看起来一样,例如 legend、rangeSelector、navigator、yAxis.opposite 和 scrollbar.
使用 Highcharts,是否可以按月绘制柱形图(如一月、二月、三月),作为数据,我有时间戳,但无法将数据分组到每个月的列。
http://jsfiddle.net/k6onhj2xenter code here
xAxis: {
type: 'datetime',
dateTimeLabelFormats: { // don't display the dummy year
month: '%e. %b',
year: '%b'
},
title: {
text: 'Date'
}
}
这里的图表是按时间戳显示的,但我想将其转换为按月显示。
在Highcharts
中不可能,但在Highstock
中可以。有选项 dataGrouping 可以放在 plotOptions
:
plotOptions: {
column: {
dataGrouping: {
forced: true,
units: [['month', [1]]]
}
}
}
这将强制图表每 1 个月对数据进行分组。 但是使用 Highstock 会改变你的大部分选项,你可以改回来。
这是更改所有选项后的样子:jsfiddle
正如我所说,您必须更改很多选项才能使其看起来一样,例如 legend、rangeSelector、navigator、yAxis.opposite 和 scrollbar.