nueza99
Posts: 25
Joined: Tue Aug 18, 2020 5:14 am

How to add custom event in rangeSelector, buttons

Hi,

I need to add new button in my rangeSelector namely ' 2 weeks', which I managed to do, but how can I add event that will be calling totally new api.

https://jsfiddle.net/cj23fhxs/
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: How to add custom event in rangeSelector, buttons

Hello nueza99,

Thanks for contacting us with your question. Range will be selected automatically, you just need to pass two valid options: type and count. In your example you have used type: 'weeks' instead of 'week' and thats why it didnt work.
Demo:https://jsfiddle.net/BlackLabel/jwems1yr/
API reference: https://api.highcharts.com/highstock/ra ... ttons.type,
https://api.highcharts.com/highstock/ra ... tons.count

Let me know if that was what you were looking for!
Regards!
Mateusz Bernacik
Highcharts Developer
nueza99
Posts: 25
Joined: Tue Aug 18, 2020 5:14 am

Re: How to add custom event in rangeSelector, buttons

Hi,

Really appreciate you reply, but I would like to add click function that calls api when selecting 2w/1m/3m... since my system required me to call different api for each and every button due to large data.
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: How to add custom event in rangeSelector, buttons

Hi nueza99,

Sure, I get it. In this case you should use click event.
Demo:https://jsfiddle.net/gh/get/library/pur ... ton-click/
API reference: https://api.highcharts.com/highstock/ra ... ents.click

Let me know if you have any further questions!
Regards!
Mateusz Bernacik
Highcharts Developer
nueza99
Posts: 25
Joined: Tue Aug 18, 2020 5:14 am

Re: How to add custom event in rangeSelector, buttons

Hi,

Thank you so much for the help, this solved my issue, :D :D
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: How to add custom event in rangeSelector, buttons

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

Return to “Highcharts Stock”