krshnhari
Posts: 15
Joined: Thu Jan 09, 2020 11:43 am

Avoid shoulder in custom indicator charts

Hi,

I have a custom indicator that recomputes itself upon updates to axis extreme (more on this at viewtopic.php?f=9&t=45431) - in some cases (for example, when zoomed in via range selector), the Y axis range is computed incorrectly. I figured this is due to the way extremes are computed in the default series implementation that accounts for the shoulder (https://github.com/highcharts/highchart ... s.ts#L4410).

I was able to avoid that by setting the default cropShoulder as 0 but that presented another issue as can be seen in the attached.

Is there a recommendation to avoid this highlighted spurious line?

Thanks,
Krishna
krshnhari
Posts: 15
Joined: Thu Jan 09, 2020 11:43 am

Re: Avoid shoulder in custom indicator charts

Adding missed attachment in the previous post
ChartIssueWithShoulder.PNG
ChartIssueWithShoulder.PNG (13.99 KiB) Viewed 321 times
dominik.c
Posts: 2081
Joined: Fri Aug 07, 2020 7:07 am

Re: Avoid shoulder in custom indicator charts

Hello krshnhari!

We appreciate you reaching out to us!

In API there's no property as cropShoulder. Could you reproduce the issue in an online editor that I could work on? Then I could check the whole code and figure out how to avoid this highlighted spurious line. You can find a basic template in the link below. :)

Demo:
https://jsfiddle.net/BlackLabel/ewq7ropt/

Best regards!
Dominik Chudy
Highcharts Developer
krshnhari
Posts: 15
Joined: Thu Jan 09, 2020 11:43 am

Re: Avoid shoulder in custom indicator charts

https://jsfiddle.net/Lwk0j5as/5/

The above fiddle demonstrates the issue with incorrect axis extremes computation - this is because the value at `minIndex - 1`is considered for computing the axis extremes for a range [minIndex, maxIndex].

I was able to workaround that in https://jsfiddle.net/Lwk0j5as/6/ by defining a cropShoulder value of 0 (as opposed to the default value of 1) which lead to the image attached above (although it is not reproducing in the fiddle). Could it be because of a particular options setting?

Let me know in case of any doubts with the above.

Thanks,
Krishna
krshnhari
Posts: 15
Joined: Thu Jan 09, 2020 11:43 am

Re: Avoid shoulder in custom indicator charts

To summarize, two questions emerge from the above:

1. Is there an alternate solution to the axis extremes issue in https://jsfiddle.net/Lwk0j5as/5/ ?
2. In the solution with cropShoulder=0, how can I ensure to restrict the plot area to start and end exactly at minExtreme and maxExtreme respectively?


Thanks again for looking into this topic and do let me know if this belongs in another forum (like Github issue).
dominik.c
Posts: 2081
Joined: Fri Aug 07, 2020 7:07 am

Re: Avoid shoulder in custom indicator charts

Hi again!

Thanks for explaining this issue so precisely, I appreciate it a lot. :)

I'm not sure if there is another solution to the axis extremes issue. I suggest reporting this issue on our GitHub with your suggested solution and the description you've posted here. We will discuss possible solutions over there.

Link: https://github.com/highcharts/highchart ... new/choose

Best regards!
Dominik Chudy
Highcharts Developer

Return to “Highcharts Stock”