streamlinesocial / highcharts-regression

Linear and non-linear regression support for highcharts

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Multiple series with different regression algorithms

ruidiasbraga opened this issue · comments

Dear phpepe,

I found that by having multiple series with different regression algorithms in the same chart and having ZERO values on some, sometimes got an error because of that calculations, Math.log(0) for example, giving '-infinity' and converting to "NaN".

in this cases I made a simple fix to prevent all other from not drawing and the user don't understanding what is going on. so, in you code

 if (extraSerie.visible === false) {
                extraSerie.visible = false;
}

I had a simple condition to no drawing the specific regression line in error. They will still appear in the legend, but disabled, if user clicks, then, the error will occur and all other will not be drawn (need to fix this too)

            if (extraSerie.visible === false || regression.string.includes('NaN')) {
                extraSerie.visible = false;
            }

What you think? Are you willing to add this to the source code?
Best Regards