Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var distinct = [];
for(var i=0; i< regressionData.length; i++){
if (distinct.includes(regressionData[i][0]) == false){
distinct.push(regressionData[i][0]);
}
}
for(var i=0; i< distinct.length; i++){
this['class' +i] = [];
for(var j=0; j< regressionData.length; j++){
if(regressionData[j][0] == distinct[i]){
this['class' +i].push(new Array(regressionData[j][1], regressionData[j][2]));
}
}
this['regressionLine' +i] = SiSt.linearRegressionLine(SiSt.linearRegression(this['class' +i]));
}
for(var i=0; i< distinct.length; i++){
this['Atsc' +i] = [];
for(var j=0; j< Atsc.features.length; j++){
if(Atsc.features[j].properties.class == distinct[i]){
Atsc.features[j].properties.Ptx = this['regressionLine' +i](Atsc.features[j].properties.Atsc);
}
}
}
target.features.forEach(d => {
d.properties.Pt = 0;
for(var i=0; i< Atsc.features.length; i++){
if(Atsc.features[i].properties.targetId == d.properties.targetId){
export const getGraphData = (data: any, activeIndex: number) => {
const { dateField, valueField } = TRENDS[activeIndex]
const formattedCostData = map(data, (x) => ({ date: DateTime.fromISO(x[dateField]).valueOf(), value: x[valueField] }))
const regressionData = map(formattedCostData, (x) => [x.date, x.value])
const regression = linearRegression(regressionData)
const lineFn = linearRegressionLine(regression)
return map(formattedCostData, (x, index) => ({ ...x, trendData: lineFn(first(regressionData[index])) }))
}