Display test graph

This commit is contained in:
Joscha 2023-08-15 00:36:40 +02:00
parent 3c9fc1ce75
commit 476fd84d2d
6 changed files with 53 additions and 14 deletions

View file

@ -1,7 +1,43 @@
import uPlot from "./uPlot";
import uPlot from "./uPlot.js";
let plot = new uPlot({
width: 300,
height: 200,
series: [],
});
interface GraphData {
hashes: string[];
times: number[];
metrics: { [key: string]: (number | null)[]; };
}
let opts = {
title: "HEHE",
width: 600,
height: 400,
series: [
{},
{
label: "wall-clock/build",
spanGaps: true,
stroke: "blue",
width: 1,
}
],
};
let plot = new uPlot(opts, [], document.body);
fetch("data?metric=wall-clock/build")
.then(r => r.json() as Promise<GraphData>)
.then(data => {
console.log(data);
plot.setData([
data.times,
data.metrics["wall-clock/build"]!,
]);
});
// function display(metrics: string[]) {
// let url = "data" + new URLSearchParams(metrics.map(m => ["metric", m]));
// fetch(url)
// .then(r => r.json() as Promise<GraphData>)
// .then(data => {
// })
// }