rushikesh
Posts: 31
Joined: Wed Jul 20, 2022 10:14 am

setting effective timeline in highstocks

Mon Apr 24, 2023 9:39 am

Hello,

https://www.highcharts.com/demo/stock/i ... andlestick

in above example, by default saturday and sundays are removed. and timeline only shows monday to friday only.

that is nice because without much coding, we gain a cool feature by default.

I added range selector for 5 days, when i click on 5 day range selection button, it does not omit sunday and saturday.
We also have timezone as well.
So, based on timezone, saturday and sunday should be ommited.
how to configure that?

jedrzej.r
Posts: 515
Joined: Tue Jan 24, 2023 11:21 am

Re: setting effective timeline in highstocks

Mon Apr 24, 2023 7:01 pm

Hi!

Thanks for reaching out to us with your question!

I've added a 5-day range selector and set the timezone to 'Asia/Bangok' (GMT + 7H), but unfortunately I wasn't able to reproduce mentioned problem. Could you please provide more detail and update this fiddle with your configuration, so I can investigate it further?

Live demo: https://jsfiddle.net/BlackLabel/ryzokc1x/

API: https://api.highcharts.com/highcharts/time.timezone

I'm waiting for your reply!
Best regards!
Jędrzej Ruta
Highcharts Developer

rushikesh
Posts: 31
Joined: Wed Jul 20, 2022 10:14 am

Re: setting effective timeline in highstocks

Tue Apr 25, 2023 7:26 am

Thanks for responding! in demo that you created, using window selector, set the end date to (thursday, 13 Oct) . so that it cover all the data points of 13th Oct. and then click on 5d range selector button. you will see that start date is setting to Monday. and monday to thursday is total 4 days. i want that it should cover friday(7th Oct) as well. :)
it should effectively show 5 days.

rushikesh
Posts: 31
Joined: Wed Jul 20, 2022 10:14 am

Re: setting effective timeline in highstocks

Tue Apr 25, 2023 7:35 am

to elaborate more,
When startdate is set to Monday, it (10th Oct) So, 10th - 13th Oct is only 4 days. I need that by clicking on 5d it should show 7th Oct to 13th Oct.
If some portion of Thursday (13th Oct) is omitted. say 3 hours then by clicking on 5d, 3 hours of 6th Oct should also be shown.

jedrzej.r
Posts: 515
Joined: Tue Jan 24, 2023 11:21 am

Re: setting effective timeline in highstocks

Wed Apr 26, 2023 11:42 am

Hi!

Thanks for elaborating more on the topic! It seems to be a bug related to rangeSelector, as it should always choose a 5-day range. I've reported this issue on Highcharts repository, you can track its status here: https://github.com/highcharts/highcharts/issues/18883.

In case of any other questions, feel free to ask anytime!
Best regards!
Jędrzej Ruta
Highcharts Developer

rushikesh
Posts: 31
Joined: Wed Jul 20, 2022 10:14 am

Re: setting effective timeline in highstocks

Thu Apr 27, 2023 10:56 am

Thanks for the help!

jedrzej.r
Posts: 515
Joined: Tue Jan 24, 2023 11:21 am

Re: setting effective timeline in highstocks

Thu Apr 27, 2023 12:03 pm

You're welcome! In case of any further questions, feel free to contact us again.

Best regards!
Jędrzej Ruta
Highcharts Developer

rushikesh
Posts: 31
Joined: Wed Jul 20, 2022 10:14 am

Re: setting effective timeline in highstocks

Thu Jun 22, 2023 10:13 am

https://github.com/highcharts/highcharts/issues/18883. this issue did not help much. I appreciate the efforts being put in it. but our users want that when range selector is used, it should ignore the weekend and show the effective business days in the graph.
If I set ordinal to false then it shows empty spaces which is also not required behavior.
is there any effective solution?
what I did to fix this is :
I handled the setExtremes event and set the new extremes after calculation. but would be better if config based solution is there.

jedrzej.r
Posts: 515
Joined: Tue Jan 24, 2023 11:21 am

Re: setting effective timeline in highstocks

Thu Jun 22, 2023 12:30 pm

Hi!

I'm really glad to hear that you've been able to come up with a proper solution to your problem. I believe that such approach is the most optimal way, since there is no option available in the API. Based on the fact that such solution is a simple custom, we didn't plan on adding it to HighStock library. If you believe it would be helpful for other users, you can propose a feature request here: https://github.com/highcharts/highchart ... .md&title=.
With a sufficient number of positive feedback from users, we will consider a native implementation of this feature.

In case of any other questions related to Highcharts functionality, feel free to ask anytime.
Best regards!
Jędrzej Ruta
Highcharts Developer

rushikesh
Posts: 31
Joined: Wed Jul 20, 2022 10:14 am

Re: setting effective timeline in highstocks

Thu Jun 22, 2023 2:40 pm

is it possible to have plugin based solution? what if I want to develop such plugin which can be plugged in any highcharts instance and do the required thing? is it possible to achieve using xAxis.breaks?

jedrzej.r
Posts: 515
Joined: Tue Jan 24, 2023 11:21 am

Re: setting effective timeline in highstocks

Fri Jun 23, 2023 8:34 am

Of course! Highcharts is a versatile charting library that allows you to adapt to your requirements. There multiple ways to create such plugin, ou can read more about this topic here: https://www.highcharts.com/docs/extendi ... highcharts.

I believe that it should be possible by using xAxis.breaks and it seems to be the best solution to your problem.

Let me know if you have any more questions.
Best regards!
Jędrzej Ruta
Highcharts Developer

rushikesh
Posts: 31
Joined: Wed Jul 20, 2022 10:14 am

Re: setting effective timeline in highstocks

Fri Jun 23, 2023 11:31 am

If i set x.breaks of weekend days, does rangeselector (for example 5 days) will ignore the breaks while calculating the range?
for example, if right extreme on graph is on wednesday last hour, If I click on 5 days range selector button, will it show thursday to wednesday (effective 5 days, thursday, friday, monday, tuesday, wednesday) rather than saturday to wednesday (saturday, sunday, monday, tuesday, wednesday)?

rushikesh
Posts: 31
Joined: Wed Jul 20, 2022 10:14 am

Re: setting effective timeline in highstocks

Mon Jun 26, 2023 8:11 am

it would be better if any example is given using breaks to ignore weekend days while using rangeselection button.

jedrzej.r
Posts: 515
Joined: Tue Jan 24, 2023 11:21 am

Re: setting effective timeline in highstocks

Mon Jun 26, 2023 8:47 am

Hi!

The range selector should ignore the breaks, as they are left out from the chart after being defined. Take a glance at the demo below, based on this example: https://jsfiddle.net/gh/get/library/pur ... ay-breaks/

Live demo: https://jsfiddle.net/BlackLabel/Lu92qr3d/

API:
https://api.highcharts.com/highstock/xAxis.breaks

Let me know if that was what you were looking for.
Best regards!
Jędrzej Ruta
Highcharts Developer

rushikesh
Posts: 31
Joined: Wed Jul 20, 2022 10:14 am

Re: setting effective timeline in highstocks

Mon Jun 26, 2023 10:08 am

but then candles are not looking beautiful by default in above example, why is the case? and how to fix it?

Return to “Highcharts Stock”