dev_ltd
Posts: 17
Joined: Wed Jul 25, 2018 11:51 am

AfterSetExtremes looping issue when set data is out of view

Hi there,

I have an issue with the navigator bar jumping around in a loop and triggering AfterSetExtremes.

It happens when I set then redraw the series with two data points that are outside of the navigator view, as show below.

Image

adaptToUpdatedData has been set to false on the navigator, is there something missing that isn't allowing me to set data outside of the current view without causing the navigator to jump?
bastss
Site Admin
Posts: 1204
Joined: Wed Oct 17, 2018 10:59 am

Re: AfterSetExtremes looping issue when set data is out of v

Hi dev_ltd,
Could you send online demo of your code (using jsFiddle or Codepen for example)? It will be easier to help with your problem ;)
Best regards!
Sebastian Wędzel,
Highcharts Developer
dev_ltd
Posts: 17
Joined: Wed Jul 25, 2018 11:51 am

Re: AfterSetExtremes looping issue when set data is out of view

EDIT: We are using Highstock v5.0.14

Hi bastss and all,

I have been re-assigned to this problem.

I cannot get a demo to replicate this unfortunately, however we have a video to illustrate the problem if this can suffice.

Here is a link to the video: https://vimeo.com/314526526

Regards.
bastss
Site Admin
Posts: 1204
Joined: Wed Oct 17, 2018 10:59 am

Re: AfterSetExtremes looping issue when set data is out of view

Hey dev_Itd,

Unfortunately, this video didn't help resolve your issue. Please try to reproduce it as an online demo. Here is a simple stack template: https://jsfiddle.net/BlackLabel/3ef70jac/

Best regards!
Sebastian Wędzel,
Highcharts Developer
dev_ltd
Posts: 17
Joined: Wed Jul 25, 2018 11:51 am

Re: AfterSetExtremes looping issue when set data is out of view

Hi batss,

I have managed to make an code snippet that is similar to our problem, minus the constant looping.

Here is the fiddle: https://jsfiddle.net/0u1cr5ae/1/

The fiddle has one series, when I click "View no data area" I am setting the time on the chart to look between 19/01/2019 from 03:00 to 18:00. I am also setting the series data to have two points, one at 18/01/2019 @ 07:15 and one at 20/01/2019 @ 14:57. Basically I am setting my series to have two data points and I am viewing a time in between those data points.

I would expect to only see a line, knowing that I am looking in between data points. Instead, clicking the button makes my view change to the dates of the set data points.

I can notice the after set extremes is triggered twice when the button is clicked.
dev_ltd
Posts: 17
Joined: Wed Jul 25, 2018 11:51 am

Re: AfterSetExtremes looping issue when set data is out of view

Cannot edit my previous post, here is the working JSFiddle https://jsfiddle.net/0u1cr5ae/2/
bastss
Site Admin
Posts: 1204
Joined: Wed Oct 17, 2018 10:59 am

Re: AfterSetExtremes looping issue when set data is out of view

Hello dev_Itd!

So in the provided demo, I've noticed two things responsible for this behavior.

First - you are using Highstock version 5.0.14. In the newest version, this behavior doesn't exist - simple demo: https://jsfiddle.net/BlackLabel/ugvx40ad/

Second - in your example, first setExtrems function is generate and later two points are added. Improve demo: https://jsfiddle.net/BlackLabel/czhtqLob/

Best regards!
Sebastian Wędzel,
Highcharts Developer
dev_ltd
Posts: 17
Joined: Wed Jul 25, 2018 11:51 am

Re: AfterSetExtremes looping issue when set data is out of view

Hi again bastss,

The fiddle you have provided does not include the navigator data remaining the same as it was on the initial load.

I have modified your fiddle to include this, now when I try to set the data to two data points and set the extreme inside those two points I do not get the view I expect.

https://jsfiddle.net/x1ue9mno/1/

Thanks for your help.
bastss
Site Admin
Posts: 1204
Joined: Wed Oct 17, 2018 10:59 am

Re: AfterSetExtremes looping issue when set data is out of view

dev_Itd,
The fiddle you have provided does not include the navigator data remaining the same as it was on the initial load.


What do you have in mind? Notice that after the chart loaded navigator inherited data from series. After click event, a new chart is generated and navigator inherits data from the new series which is set after the click. Do you want to keep initial data in the navigator?

To make setExtremes event works in your example we need to change xAxis.minRange value, which is set by default to 5. In the documentation, you can find information which says that: " Also, setExtremes will not allow a range lower than the minRange option, which by default is the range of five points." - link: https://api.highcharts.com/class-refere ... etExtremes

Working sample: https://jsfiddle.net/BlackLabel/u6m9438c/.

Best regards!
Sebastian Wędzel,
Highcharts Developer
dev_ltd
Posts: 17
Joined: Wed Jul 25, 2018 11:51 am

Re: AfterSetExtremes looping issue when set data is out of view

bastss wrote: Wed Feb 20, 2019 12:06 pm Do you want to keep initial data in the navigator?

To make setExtremes event works in your example we need to change xAxis.minRange value, which is set by default to 5. In the documentation, you can find information which says that: " Also, setExtremes will not allow a range lower than the minRange option, which by default is the range of five points." - link: https://api.highcharts.com/class-refere ... etExtremes

Working sample: https://jsfiddle.net/BlackLabel/u6m9438c/.

Yes I do want to keep the initial data. The xAxis.minRange being undefined in our application was the issue, after setting the minRange it has stopped the problem.

Thank you for the help bastss!

Return to “Highcharts Stock”