Hello,
Is there a way to display data with a week grouping by default? The rangeSelector buttons should not be displayed on top of the graph so the week grouping should be automatic on graph loading/update.
Thanks for your help
Code: Select all
plotOptions: {
series: {
preserveDataGrouping: true,
dataGrouping: {
units: [
[
'week',
[1]
]
]
}
}
},
Code: Select all
if(weekOnly.includes(varSelected)){
chart.update({
rangeSelector: {
buttons: [],
},
plotOptions: {
series: {
dataGrouping: {
forced: true,
units: [
[
'week',
[1]
]
]
}
},
},
chart: {
type: type
},
legend: {
enabled: true
},
data: {
csv: chartData
},
});
}else{
chart.update({
chart: {
type: type
},
legend: {
enabled: true
},
rangeSelector: {
buttonTheme: {
width: 120,
style: {
color: '#1C819a',
fontWeight: 'bold'
},
},
enabled: true,
inputEnabled: true,
inputDateFormat: '%e %b %Y',
inputEditDateFormat: '%Y-%m-%e',
allButtonsEnabled: true,
buttons: [{
type: 'month',
count: 6,
text: 'Days',
dataGrouping: {
forced: true,
groupAll: true,
units: [
['day', [1]]
],
dateTimeLabelFormats: {
day: ["%e %B %Y"],
}
},
}, {
type: 'year',
count: 1,
text: 'Weeks',
preserveDataGrouping: true,
dataGrouping: {
forced: true,
groupAll: true,
units: [
['week', [1]]
],
dateTimeLabelFormats: {
week: ["Week: %e %B %Y"],
}
},
}, {
type: 'year',
count: 1,
text: 'Months',
preserveDataGrouping: true,
dataGrouping: {
forced: true,
groupAll: true,
units: [
['month', [1]]
],
dateTimeLabelFormats: {
week: ["%B %Y"],
}
},
}, {
type: 'year',
count: 1,
text: 'Years',
preserveDataGrouping: true,
dataGrouping: {
forced: true,
groupAll: true,
units: [
['year', [1]]
],
dateTimeLabelFormats: {
week: ["%B %Y"],
}
},
}],
},
data: {
csv: chartData
},
});
}
Code: Select all
if(weekOnly.includes(variable)){
chart.rangeSelector.clickButton(1)
}else{
chart.rangeSelector.clickButton(0)
}