You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be nice to be able to do the trendline just for some part or range of the data.
In my case just for the last 10 elements. I did a quick hack and implemented a trendoffset parameter.
If > 0 it skips the first n elements, if < 0 it uses the last n elements.
The patch alters the firstIndex initialisation accordingly.
My code looks like this:
...
let fitter = new LineFitter();
// implement trendoffset paramater, alters firstIndex.
let trendoffset = dataset.trendlineLinear.trendoffset || 0;
if(Math.abs(trendoffset) >= dataset.data.length) trendoffset = 0;
let firstIndex = ((trendoffset<0)?dataset.data.length:0) + trendoffset + dataset.data.slice(trendoffset).findIndex((d) => {
return d !== undefined && d !== null;
});
let lastIndex = dataset.data.length - 1;
...
The config looks like this:
trendlineLinear: {
trendoffset: -10,
...
},
The text was updated successfully, but these errors were encountered:
It would be nice to be able to do the trendline just for some part or range of the data.
In my case just for the last 10 elements. I did a quick hack and implemented a trendoffset parameter.
If > 0 it skips the first n elements, if < 0 it uses the last n elements.
The patch alters the firstIndex initialisation accordingly.
My code looks like this:
...
let fitter = new LineFitter();
...
The config looks like this:
trendlineLinear: {
trendoffset: -10,
...
},
The text was updated successfully, but these errors were encountered: