Delete tests/9_stream_visualizer/outputs_gemini directory

This commit is contained in:
2025-11-26 18:02:56 -08:00
committed by GitHub
parent 025d7c2e9c
commit 714d1149a8
21 changed files with 0 additions and 521 deletions

View File

@@ -1,20 +0,0 @@
const createStreamVisualizer = async (src, { maxPoints: m, alpha: a, width: w, height: h, yDomain: yd }) => {
const { scaleLinear, line } = await import('https://esm.sh/d3@7');
const D = [];
let e;
for await (const { timestamp: t, value: v } of src) {
e = e === undefined ? v : a * v + (1 - a) * e;
D.push({ timestamp: t, value: v, ema: e });
if (D.length > m) D.shift();
}
if (!D.length) return { data: D, path: '' };
const x = scaleLinear().domain([D[0].timestamp, D[D.length - 1].timestamp]).range([0, w]);
const y = scaleLinear().domain(yd).range([h, 0]);
const l = line().x(d => x(d.timestamp)).y(d => y(d.ema));
return { data: D, path: l(D) };
};
export default createStreamVisualizer;

View File

@@ -1,20 +0,0 @@
const createStreamVisualizer = async (iter, { maxPoints: M, alpha: A, width: W, height: H, yDomain: Y }) => {
const { scaleLinear, line } = await import('https://cdn.jsdelivr.net/npm/d3@7/+esm')
const D = []
let E
for await (const { timestamp: t, value: v } of iter) {
E = E === undefined ? v : A * v + (1 - A) * E
D.push({ timestamp: t, value: v, ema: E })
if (D.length > M) D.shift()
}
if (!D.length) return { data: D, path: '' }
const x = scaleLinear().domain([D[0].timestamp, D.at(-1).timestamp]).range([0, W])
const y = scaleLinear().domain(Y).range([H, 0])
const l = line().x(d => x(d.timestamp)).y(d => y(d.ema))
return { data: D, path: l(D) }
}
export default createStreamVisualizer;

View File

@@ -1,29 +0,0 @@
export const createStreamVisualizer = async (feed, { maxPoints, alpha, width, height, yDomain }) => {
const { scaleLinear, line } = await import('https://esm.sh/d3@7');
const data = [];
let prev;
for await (const { timestamp, value } of feed) {
const ema = prev == null ? value : alpha * value + (1 - alpha) * prev;
prev = ema;
data.push({ timestamp, value, ema });
if (data.length > maxPoints) data.shift();
}
if (!data.length) return { data, path: "" };
const x = scaleLinear()
.domain([data[0].timestamp, data.at(-1).timestamp])
.range([0, width]);
const y = scaleLinear()
.domain(yDomain)
.range([height, 0]);
const pathGen = line()
.x(d => x(d.timestamp))
.y(d => y(d.ema));
return { data, path: pathGen(data) };
};
export default createStreamVisualizer;

View File

@@ -1,28 +0,0 @@
const createStreamVisualizer = async (feed, { maxPoints, alpha, width, height, yDomain }) => {
const { scaleLinear, line } = await import('https://esm.sh/d3@7');
const data = [];
let ema;
for await (const { timestamp, value } of feed) {
ema = ema == null ? value : alpha * value + (1 - alpha) * ema;
data.push({ timestamp, value, ema });
if (data.length > maxPoints) data.shift();
}
if (!data.length) return { data, path: '' };
const x = scaleLinear()
.domain([data[0].timestamp, data.at(-1).timestamp])
.range([0, width]);
const y = scaleLinear()
.domain(yDomain)
.range([height, 0]);
const path = line()
.x(d => x(d.timestamp))
.y(d => y(d.ema))(data);
return { data, path: path || '' };
};
export default createStreamVisualizer;

View File

@@ -1,27 +0,0 @@
export const createStreamVisualizer = async (feed, { maxPoints: m, alpha: a, width: w, height: h, yDomain: yd }) => {
const { scaleLinear, line } = await import('https://esm.sh/d3');
let data = [], ema;
for await (const { timestamp: t, value: v } of feed) {
ema = ema == null ? v : a * v + (1 - a) * ema;
data.push({ timestamp: t, value: v, ema });
if (data.length > m) data.shift();
}
if (!data.length) return { data, path: "" };
const x = scaleLinear()
.domain([data[0].timestamp, data.at(-1).timestamp])
.range([0, w]);
const y = scaleLinear()
.domain(yd)
.range([h, 0]);
const gen = line()
.x(d => x(d.timestamp))
.y(d => y(d.ema));
return { data, path: gen(data) };
};
export default createStreamVisualizer;

View File

@@ -1,27 +0,0 @@
const createStreamVisualizer = async (feed, { maxPoints: max, alpha, width, height, yDomain }) => {
const d3 = await import('https://esm.sh/d3');
let data = [], ema;
for await (const { timestamp, value } of feed) {
ema = ema == null ? value : alpha * value + (1 - alpha) * ema;
data.push({ timestamp, value, ema });
if (data.length > max) data.shift();
}
if (!data.length) return { data, path: "" };
const x = d3.scaleLinear()
.domain([data[0].timestamp, data.at(-1).timestamp])
.range([0, width]);
const y = d3.scaleLinear()
.domain(yDomain)
.range([height, 0]);
const path = d3.line()
.x(d => x(d.timestamp))
.y(d => y(d.ema))(data);
return { data, path };
};
export default createStreamVisualizer;

View File

@@ -1,20 +0,0 @@
export const createStreamVisualizer = async (src, { maxPoints: m, alpha: a, width: w, height: h, yDomain: yd }) => {
const { scaleLinear, line } = await import('https://esm.sh/d3@7');
const data = [];
let ema;
for await (const { timestamp: t, value: v } of src) {
ema = ema === undefined ? v : a * v + (1 - a) * ema;
data.push({ timestamp: t, value: v, ema });
if (data.length > m) data.shift();
}
if (!data.length) return { data, path: '' };
const x = scaleLinear().domain([data[0].timestamp, data.at(-1).timestamp]).range([0, w]);
const y = scaleLinear().domain(yd).range([h, 0]);
const d = line().x(p => x(p.timestamp)).y(p => y(p.ema))(data);
return { data, path: d || '' };
};
export default createStreamVisualizer;

View File

@@ -1,28 +0,0 @@
export const createStreamVisualizer = async (stream, { maxPoints, alpha, width, height, yDomain }) => {
const { scaleLinear, line } = await import('d3');
const data = [];
let ema;
for await (const { timestamp, value } of stream) {
ema = (ema ?? value) * (1 - alpha) + value * alpha;
data.push({ timestamp, value, ema });
if (data.length > maxPoints) data.shift();
}
if (!data.length) return { data, path: '' };
const x = scaleLinear()
.domain([data[0].timestamp, data.at(-1).timestamp])
.range([0, width]);
const y = scaleLinear()
.domain(yDomain)
.range([height, 0]);
const pathGen = line()
.x(d => x(d.timestamp))
.y(d => y(d.ema));
return { data, path: pathGen(data) };
};
export default createStreamVisualizer;

View File

@@ -1,20 +0,0 @@
export const createStreamVisualizer = async (src, { maxPoints: max, alpha: a, width: w, height: h, yDomain: yD }) => {
const { scaleTime, scaleLinear, line } = await import('https://esm.sh/d3');
const data = [];
let ema;
for await (const { timestamp: t, value: v } of src) {
ema = ema == null ? v : a * v + (1 - a) * ema;
data.push({ timestamp: t, value: v, ema });
if (data.length > max) data.shift();
}
if (!data.length) return { data, path: '' };
const x = scaleTime().domain([data[0].timestamp, data.at(-1).timestamp]).range([0, w]);
const y = scaleLinear().domain(yD).range([h, 0]);
const path = line().x(d => x(d.timestamp)).y(d => y(d.ema))(data);
return { data, path: path || '' };
};
export default createStreamVisualizer;

View File

@@ -1,28 +0,0 @@
export const createStreamVisualizer = async (iter, { maxPoints: max, alpha: a, width: w, height: h, yDomain: yd }) => {
const { scaleLinear, line } = await import('https://esm.sh/d3');
const data = [];
let ema;
for await (const { timestamp: t, value: v } of iter) {
ema = ema == null ? v : a * v + (1 - a) * ema;
data.push({ timestamp: t, value: v, ema });
if (data.length > max) data.shift();
}
if (!data.length) return { data, path: '' };
const x = scaleLinear()
.domain([data[0].timestamp, data[data.length - 1].timestamp])
.range([0, w]);
const y = scaleLinear()
.domain(yd)
.range([h, 0]);
const gen = line()
.x(d => x(d.timestamp))
.y(d => y(d.ema));
return { data, path: gen(data) };
};
export default createStreamVisualizer;

View File

@@ -1,28 +0,0 @@
export const createStreamVisualizer = async (stream, { maxPoints, alpha, width, height, yDomain }) => {
const { scaleLinear, line } = await import('https://esm.sh/d3');
const data = [];
for await (const { timestamp, value } of stream) {
const prev = data.at(-1);
const ema = prev ? alpha * value + (1 - alpha) * prev.ema : value;
data.push({ timestamp, value, ema });
if (data.length > maxPoints) data.shift();
}
if (!data.length) return { data, path: null };
const x = scaleLinear()
.domain([data[0].timestamp, data.at(-1).timestamp])
.range([0, width]);
const y = scaleLinear()
.domain(yDomain)
.range([height, 0]);
const generator = line()
.x(d => x(d.timestamp))
.y(d => y(d.ema));
return { data, path: generator(data) };
};
export default createStreamVisualizer;

View File

@@ -1,25 +0,0 @@
export const createStreamVisualizer = async (
stream,
{ maxPoints: M, alpha: A, width: W, height: H, yDomain: Y }
) => {
const { scaleLinear, line } = await import("https://esm.sh/d3@7");
const data = [];
let ema;
for await (const { timestamp: t, value: v } of stream) {
ema = ema == null ? v : A * v + (1 - A) * ema;
data.push({ timestamp: t, value: v, ema });
if (data.length > M) data.shift();
}
if (!data.length) return { data, path: "" };
const x = scaleLinear()
.domain([data[0].timestamp, data.at(-1).timestamp])
.range([0, W]);
const y = scaleLinear().domain(Y).range([H, 0]);
const path = line().x(d => x(d.timestamp)).y(d => y(d.ema))(data);
return { data, path };
};
export default createStreamVisualizer;

View File

@@ -1,29 +0,0 @@
export const createStreamVisualizer = async (feed, { maxPoints, alpha, width, height, yDomain }) => {
const { scaleLinear, line } = await import('https://cdn.jsdelivr.net/npm/d3@7/+esm')
const data = []
let prev = null
for await (const { timestamp, value } of feed) {
const ema = prev === null ? value : alpha * value + (1 - alpha) * prev
prev = ema
data.push({ timestamp, value, ema })
if (data.length > maxPoints) data.shift()
}
if (!data.length) return { data, path: '' }
const x = scaleLinear()
.domain([data[0].timestamp, data.at(-1).timestamp])
.range([0, width])
const y = scaleLinear()
.domain(yDomain)
.range([height, 0])
const gen = line()
.x(d => x(d.timestamp))
.y(d => y(d.ema))
return { data, path: gen(data) }
}
export default createStreamVisualizer;

View File

@@ -1,14 +0,0 @@
export const createStreamVisualizer = async (stream, { maxPoints, alpha, width, height, yDomain }) => {
const { scaleLinear, line } = await import('https://cdn.jsdelivr.net/npm/d3@7/+esm')
let data = [], ema
for await (const { timestamp: t, value: v } of stream) {
ema = ema === undefined ? v : alpha * v + (1 - alpha) * ema
data.push({ timestamp: t, value: v, ema })
if (data.length > maxPoints) data.shift()
}
if (!data.length) return { data, path: '' }
const x = scaleLinear().domain([data[0].timestamp, data.at(-1).timestamp]).range([0, width])
const y = scaleLinear().domain(yDomain).range([height, 0])
return { data, path: line().x(d => x(d.timestamp)).y(d => y(d.ema))(data) }
}
export default createStreamVisualizer;

View File

@@ -1,32 +0,0 @@
export const createStreamVisualizer = async (
source,
{ maxPoints: max, alpha, width, height, yDomain }
) => {
const { scaleTime, scaleLinear, line } = await import('https://cdn.jsdelivr.net/npm/d3@7/+esm');
let data = [], prev;
for await (const { timestamp: t, value: v } of source) {
const ema = prev === undefined ? v : alpha * v + (1 - alpha) * prev;
prev = ema;
data.push({ timestamp: t, value: v, ema });
if (data.length > max) data.shift();
}
if (!data.length) return { data, path: "" };
const x = scaleTime()
.domain([data[0].timestamp, data.at(-1).timestamp])
.range([0, width]);
const y = scaleLinear()
.domain(yDomain)
.range([height, 0]);
const pathGen = line()
.x(d => x(d.timestamp))
.y(d => y(d.ema));
return { data, path: pathGen(data) };
};
export default createStreamVisualizer;

View File

@@ -1,20 +0,0 @@
export const createStreamVisualizer = async (stream, { maxPoints, alpha, width, height, yDomain }) => {
const { scaleTime, scaleLinear, line } = await import('https://esm.sh/d3@7');
const data = [];
let ema;
for await (const { timestamp, value } of stream) {
ema = alpha * value + (1 - alpha) * (ema ?? value);
data.push({ timestamp, value, ema });
if (data.length > maxPoints) data.shift();
}
if (!data.length) return { data, path: '' };
const getX = scaleTime().domain([data[0].timestamp, data.at(-1).timestamp]).range([0, width]);
const getY = scaleLinear().domain(yDomain).range([height, 0]);
const gen = line().x(d => getX(d.timestamp)).y(d => getY(d.ema));
return { data, path: gen(data) };
};
export default createStreamVisualizer;

View File

@@ -1,21 +0,0 @@
const createStreamVisualizer = async (feed, { maxPoints: M, alpha: A, width: W, height: H, yDomain: Y }) => {
const { scaleLinear: S, line: L } = await import('https://cdn.jsdelivr.net/npm/d3@7/+esm')
const data = []; let ema
for await (const { timestamp: t, value: v } of feed) {
ema = ema == null ? v : A * v + (1 - A) * ema
data.push({ timestamp: t, value: v, ema })
if (data.length > M) data.shift()
}
if (!data.length) return { data, path: '' }
const x = S().domain([data[0].timestamp, data.at(-1).timestamp]).range([0, W])
const y = S().domain(Y).range([H, 0])
return {
data,
path: L().x(d => x(d.timestamp)).y(d => y(d.ema))(data)
}
}
export default createStreamVisualizer;

View File

@@ -1,31 +0,0 @@
export const createStreamVisualizer = async (
stream,
{ maxPoints, alpha, width, height, yDomain }
) => {
const { scaleLinear, line } = await import('https://esm.sh/d3@7')
const data = []
let prev
for await (const { timestamp, value } of stream) {
const ema = prev == null ? value : alpha * value + (1 - alpha) * prev
prev = ema
if (data.push({ timestamp, value, ema }) > maxPoints) data.shift()
}
if (!data.length) return { data, path: '' }
const xScale = scaleLinear()
.domain([data[0].timestamp, data.at(-1).timestamp])
.range([0, width])
const yScale = scaleLinear()
.domain(yDomain)
.range([height, 0])
const generator = line()
.x(d => xScale(d.timestamp))
.y(d => yScale(d.ema))
return { data, path: generator(data) }
}
export default createStreamVisualizer;

View File

@@ -1,29 +0,0 @@
export const createStreamVisualizer = async (stream, { maxPoints, alpha, width, height, yDomain }) => {
const data = [];
let prev;
for await (const { timestamp, value } of stream) {
prev = prev ?? value;
const ema = prev = alpha * value + (1 - alpha) * prev;
data.push({ timestamp, value, ema });
if (data.length > maxPoints) data.shift();
}
const { scaleLinear, line } = await import('https://cdn.jsdelivr.net/npm/d3@7/+esm');
if (!data.length) return { data, path: '' };
const x = scaleLinear()
.domain([data[0].timestamp, data.at(-1).timestamp])
.range([0, width]);
const y = scaleLinear()
.domain(yDomain)
.range([height, 0]);
return {
data,
path: line().x(d => x(d.timestamp)).y(d => y(d.ema))(data)
};
};
export default createStreamVisualizer;

View File

@@ -1,23 +0,0 @@
export const createStreamVisualizer = async (iter, { maxPoints: max, alpha, width: w, height: h, yDomain }) => {
const { scaleTime, scaleLinear, line } = await import('https://esm.sh/d3');
const data = [];
let prev;
for await (const { timestamp: t, value: v } of iter) {
const ema = prev == null ? v : alpha * v + (1 - alpha) * prev;
data.push({ timestamp: t, value: v, ema });
if (data.length > max) data.shift();
prev = ema;
}
if (!data.length) return { data, path: '' };
const x = scaleTime().domain([data[0].timestamp, data.at(-1).timestamp]).range([0, w]);
const y = scaleLinear().domain(yDomain).range([h, 0]);
return {
data,
path: line().x(d => x(d.timestamp)).y(d => y(d.ema))(data)
};
};
export default createStreamVisualizer;

View File

@@ -1,22 +0,0 @@
export const createStreamVisualizer = async (stream, { maxPoints: max, alpha, width, height, yDomain }) => {
const { scaleLinear, line } = await import('https://esm.sh/d3');
let data = [], prev;
for await (const { timestamp, value } of stream) {
const ema = prev == null ? value : alpha * value + (1 - alpha) * prev;
data.push({ timestamp, value, ema });
if (data.length > max) data.shift();
prev = ema;
}
if (!data.length) return { data, path: "" };
const x = scaleLinear().domain([data[0].timestamp, data.at(-1).timestamp]).range([0, width]);
const y = scaleLinear().domain(yDomain).range([height, 0]);
return {
data,
path: line().x(d => x(d.timestamp)).y(d => y(d.ema))(data)
};
};
export default createStreamVisualizer;