tobiqian
Posts: 3
Joined: Tue May 04, 2021 10:45 pm

trend line in certain periods

hi there

when I am showing a trend line in line graph, if the first point is null, I want to show the trend line from the second point.
if there is a point in the middle of the line which is null, the line is spited into two lines, and I want to show trend lines, one for each.
currently in this case, there will be only one trend line.
could you please let me know how I can do these? thanks
pawelys
Posts: 962
Joined: Wed Sep 02, 2020 10:37 am

Re: trend line in certain periods

Hello, Welcome to the official highcharts forum, and thanks for contacting us with your question! Could you share the demo, where you create the trendlines? Kind regards,
Paweł Lysy
Highcharts Developer
tobiqian
Posts: 3
Joined: Tue May 04, 2021 10:45 pm

Re: trend line in certain periods

https://jsfiddle.net/tobiqian/ay89j742/3/
in the example above, the line breaks into two parts because of the null value.
I want to draw one trend line from time 002 to 006,
and another trend line from 008 to 014.
how can I do that?

thanks
tobiqian
Posts: 3
Joined: Tue May 04, 2021 10:45 pm

Re: trend line in certain periods

https://jsfiddle.net/tobiqian/ay89j742/8/
in this example, when time is zoomed in from Jul 12 to May 13, I want to show a trendline calculating only in this time period, instead of the full time period, How can I achieve?

thanks
pawelys
Posts: 962
Joined: Wed Sep 02, 2020 10:37 am

Re: trend line in certain periods

Hi! The tradeline series is calculated for the whole data range for linked series, and there is no way of modifying it through the API.
What you can do, is to use 'connectNulls' Option on the line series, so that the line isn't discontinued.

https://jsfiddle.net/gh/get/library/pur ... ulls-true/
https://api.highcharts.com/highcharts/p ... nnectNulls

The other way, is splitting the series with nulls into the 2 separate series, and calculate the tradeline for them separately. https://jsfiddle.net/BlackLabel/w63kovph/
Let me know, if that works for you! Kind regards,
Paweł Lysy
Highcharts Developer

Return to “Highcharts Usage”