Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const startIndex = Math.min(left, right);
const endIndex = Math.max(left, right) + 1;
const array = fullData.slice(startIndex, endIndex);
const xs = array.map(d => xAccessor(d).valueOf());
const ys = array.map(d => d.close);
const n = array.length;
const combine = zipper()
.combine((x, y) => x * y);
const xys = combine(xs, ys);
const xSquareds = xs.map(x => Math.pow(x, 2));
const b = (n * sum(xys) - sum(xs) * sum(ys)) / (n * sum(xSquareds) - Math.pow(sum(xs), 2));
const a = (sum(ys) - b * sum(xs)) / n;
const newy1 = a + b * x1Value;
const newy2 = a + b * x2Value;
const x1 = xScale(x1Value);
const y1 = yScale(newy1);
const x2 = xScale(x2Value);
const y2 = yScale(newy2);
const stdDev = type === "SD"
? deviation(array, d => d.close)
: 0;
const dy = yScale(newy1 - stdDev) - y1;
function computeYStackedDomain(dataseries: RawDataSeries[], scaleToExtent: boolean): number[] {
const stackMap = new Map();
dataseries.forEach((ds, index) => {
ds.data.forEach((datum) => {
const stack = stackMap.get(datum.x) || [];
stack[index] = datum.y1;
stackMap.set(datum.x, stack);
});
});
const dataValues = [];
for (const stackValues of stackMap) {
dataValues.push(...stackValues[1]);
if (stackValues[1].length > 1) {
dataValues.push(sum(stackValues[1]));
}
}
if (dataValues.length === 0) {
return [];
}
return computeContinuousDataDomain(dataValues, identity, scaleToExtent);
}
processQuery: async capabilities => {
if (capabilities.hasCoordinatorAccess()) {
const resp = await axios.get('/druid/coordinator/v1/lookups/status');
const data = resp.data;
const lookupsCount = sum(Object.keys(data).map(k => Object.keys(data[k]).length));
return {
lookupsCount,
};
} else {
throw new Error(`must have coordinator access`);
}
},
onStateChange: ({ result, loading, error }) => {
.key(d => d.Kategorie)
.entries(data)
.map(d => {
if (d.values.length > 1) {
return {
...d.values[0],
Anzahl: undefined,
children: d.values
}
}
return d.values[0]
})
}).sum(d => d.Anzahl)
export const total = sum(data, d => +d.Anzahl)
export const totalChf = sum(data, d => +d.Anzahl * d['Nominal CHF'])
export const colors = {
Geldgeber: 'rgb(157, 38, 14)',
Gründerteam: 'rgb(54, 71, 63)',
'Eigenaktien Republik': '#979797',
'Project R Gen': 'rgb(65, 171, 29)'
}
const endIndex = Math.max(left, right) + 1;
const array = fullData.slice(startIndex, endIndex);
const xs = array.map(d => xAccessor(d).valueOf());
const ys = array.map(d => d.close);
const n = array.length;
const combine = zipper()
.combine((x, y) => x * y);
const xys = combine(xs, ys);
const xSquareds = xs.map(x => Math.pow(x, 2));
const b = (n * sum(xys) - sum(xs) * sum(ys)) / (n * sum(xSquareds) - Math.pow(sum(xs), 2));
const a = (sum(ys) - b * sum(xs)) / n;
const newy1 = a + b * x1Value;
const newy2 = a + b * x2Value;
const x1 = xScale(x1Value);
const y1 = yScale(newy1);
const x2 = xScale(x2Value);
const y2 = yScale(newy2);
const stdDev = type === "SD"
? deviation(array, d => d.close)
: 0;
const dy = yScale(newy1 - stdDev) - y1;
return {
graph.nodes.forEach(function (node) {
node.partOfCycle = false;
node.value = Math.max(sum(node.sourceLinks, value), sum(node.targetLinks, value));
node.sourceLinks.forEach(function (link) {
if (link.circular) {
node.partOfCycle = true;
node.circularLinkType = link.circularLinkType;
}
});
node.targetLinks.forEach(function (link) {
if (link.circular) {
node.partOfCycle = true;
node.circularLinkType = link.circularLinkType;
}
});
});
}
.rollup((values: any) => {
return sum(values, yAccessor);
})
.entries(data);
function maybeScaleToFit (G, nested) {
if (scale !== null) return
const maxValue = sum(nested.bandValues)
if (maxValue <= 0) {
scale = 1
} else {
scale = (y1 - y0) / maxValue
if (whitespace !== 1) scale *= (1 - whitespace)
}
}