AndrasOtto
Posts: 1
Joined: Tue Feb 21, 2023 7:52 am

Starting date issue with week aggregates

Dear Community,

I am looking for some help with the following example:
https://jsfiddle.net/8j7skLvu/

I have here 15 years of stock data (only weekdays). The whole line starts on 06.08.2008. I would like to have a range selector and keep the values dynamic. So if someone would like to see the development of 2010 for instance, then the values in the chart should take 01.01.2010 as the first value.

I have kind of achieved the goal, but there are some major issues:

1) The data starts on 06.08.2008 (Wednesday), and if I get the view, when weekly values are shown. The range selector and also the first day jumps back to 04.08 (Monday). This is not acceptable, because it is very important that the first point in the chart is the 06.08.2008.

2) Can I use a value from the starting period of the week instead of showing an avarege?

3) I tried to format the labels with tooltip.dateTimeLabelFormats but it did not work. I think I miss something here.

However the 3) is just a nice to have the 1) and 2) are crucial because these are hard requirements.

Thank you for any help in advance!
User avatar
dawid.d
Posts: 836
Joined: Thu Oct 06, 2022 11:31 am

Re: Starting date issue with week aggregates

Hello,

Welcome to our forum and thanks for contacting us with your question!

Your problems can be solved very easily with the data grouping option:
  1. You can disable data grouping or set firstAnchor to 'firstPoint'.
  2. If you have decided to leave grouping enabled, the solution will be to set the approximation to 'open'.
  3. There is also a dateTimeLabelFormats option in dataGrouping, try using it as in the demo below.
Demo: https://jsfiddle.net/BlackLabel/3pga94xn/

I hope you will find it useful
Best regards!
Dawid Draguła
Highcharts Developer

Return to “Highcharts Stock”