jahnvi25
Posts: 284
Joined: Thu Oct 04, 2012 12:16 pm

show series data only for visible range

i have stock chart which display 1min data for 1d.. but then i have flag series data which has almost 2 years of data. but i only want to show that flag series if it fits today ignoring rest if user is looking at 1d chart.. but then it will show if user is looking at 1year chart.. (which does)... how can i NOT show that flag series in other case

Thanks
mateuszkornecki
Posts: 1222
Joined: Mon Oct 28, 2019 10:29 am

Re: show series data only for visible range

Hello,

Just to make sure that I understood you correctly. Do you want to change the series type depending on the range selector that the user is currently using? For example, for "1d" the series type will be "flags" but for "1y" it will be changed for regular line series? If so you could trigger update() method on rangeSelector.buttons click event to change series type.
API references:
https://api.highcharts.com/class-refere ... ies#update
https://api.highcharts.com/highstock/ra ... ons.events
Live demo: https://jsfiddle.net/BlackLabel/e3vpfwLq/

Let me know if that was what you were looking for!

Kind regards.
Mateusz Kornecki
Highcharts Developer
jahnvi25
Posts: 284
Joined: Thu Oct 04, 2012 12:16 pm

Re: show series data only for visible range

this did helped me.. and i am able to achieve what i want.. but i do have one more question. i have priceChart with OHLC data.
but then i have to show flag series on top.(with x-axis data match). this also works fine. Flag data comes via ajax. but then user changes symbol.. this will reload the OHLC data (main series) and redraw all the indicators(those depends on OHLC data) but how can i find out that i have to get ajax data for new* symbol and reload the flags.. is there any event ?

thanks
mateuszkornecki
Posts: 1222
Joined: Mon Oct 28, 2019 10:29 am

Re: show series data only for visible range

It depends on how the user is changing the symbols, but I think that the easiest way to achieve that would be by calling ajax while changing the symbol. For example, on button click, I am changing the series markers and calling ajax to change data for another series.
Live demo: https://jsfiddle.net/BlackLabel/9zoh4jLg/

Feel free to ask any further questions!

Kind regards.
Mateusz Kornecki
Highcharts Developer
sbnq9
Posts: 4
Joined: Tue Aug 31, 2021 8:31 pm

Re: show series data only for visible range

https://jsfiddle.net/xdopeb2s/
when using connectNulls true option and hovering to the null value date. tooltip is showing for previous/next available dates.

In the above case if i hover 3rd Jan or 4th Jan it should show tooltip with null value for that date. Is it possible?
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: show series data only for visible range

Hello sbnq9,

I think you might have confused the topic. You probably wanted to continiue the discussion here: viewtopic.php?f=12&t=47265

To avoid the mess, please post your reply in related topic.

Best regards!
Mateusz Bernacik
Highcharts Developer

Return to “Highcharts Stock”