0👍
✅
Highstock provides dataGroupig
functionality that seems to be what you’re looking for.
Live demo: http://jsfiddle.net/kkulig/avd0gqgr/
I forced data grouping and overwrote its units on button click.
//options
xAxis: {
ordinal: false
},
plotOptions: {
series: {
dataGrouping: {
forced: true,
approximation: 'sum'
}
}
},
(...)
// button
$('#months').click(function() {
chart.update({
plotOptions: {
series: {
dataGrouping: {
units: [
[
'month', [1]
]
]
}
}
}
});
});
API reference: https://api.highcharts.com/highstock/plotOptions.series.dataGrouping
Docs reference: https://www.highcharts.com/docs/advanced-chart-features/data-grouping
Source:stackexchange.com