Group weekly data on Friday (HighStock)
Currently, when 'week' groupingUnit is specified, HighStock groups data on Monday by default. Pls provide an option to group data on Friday, like google finance did on their 5y graph.
Available since v9.1.0. You can control it, using these options:
- anchor: https://api.highcharts.com/highstock/series.line.dataGrouping.anchor
- firstAnchor: https://api.highcharts.com/highstock/series.line.dataGrouping.firstAnchor
- lastAnchor: https://api.highcharts.com/highstock/series.line.dataGrouping.lastAnchor
-
Thad Philbrick commented
Pardon the very late bump, but I wonder if this option has been rolled into Highstock? If not, do you have a suggestion on how to conditionally format the date string in the tooltip if it is a weekly grouping? It seems to be an standard in some financial circles to use the “Week ending {Friday’s Date}” syntax, rather than “Week beginning {Monday’s Date},” and our client is asking us to use it.
-
Hoang.Nguyen Viet commented
Your example is correct. I got to this wrong conclusion after comparing our the grouping on our current Flash tool (which is grouped in a different way) to HighStock.
Sorry about it. And thank you very much for your response! -
That's not the case; it shows the following week. See http://jsfiddle.net/highcharts/gtfGg/.
-
Hoang.Nguyen Viet commented
The problem is currently, value on a Monday of a week is the aggregation from Monday to Friday of the previous week. When grouping is performed on Friday, its value should be the aggregation from Monday to Friday of that current week.
If the calculation does not change, value on Friday will show the aggregation of the previous week, which is false. -
The value shown is the aggregation of the *Week starting on Monday*, so it includes Monday to Friday...
-
Hoang.Nguyen Viet commented
Torstein, thanks for your response.
In my understanding, just changing the tooltip formater can only change the display date, but the value shown is still the aggregation result associated with the Monday, not Friday. These aggregation results are calculated when the graph is created, not on tooltip format event.
Pls correct me if I'm wrong. -
That makes sense. Currently, all groups are identified by their starting date. Highcharts informs this by using "Week starting Monday ...." as the tooltip header. I think all you really have to do to change that is to create your own tooltip formatter, add 4 days to the date and print Week ending Friday... instead.