Add the sensor detail to the Diagnosis tab (D-053)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
13697e094a
commit
d00eacdfdd
3 files changed
+63
-3
No files matched your search
@@ -61,6 +61,12 @@
|
||||
font: inherit; cursor: pointer; }
|
||||
.toolbar button.active { background: var(--blue); border-color: var(--blue); color: #fff; }
|
||||
.toolbar .meta { margin-left: auto; color: var(--muted); }
|
||||
|
||||
/* Détail d'un capteur (spec §4). */
|
||||
.detail { border: 1px solid var(--line); border-radius: 4px; margin-top: 10px; }
|
||||
.detail header { display: flex; justify-content: space-between; align-items: center; padding: 6px 12px;
|
||||
border-bottom: 1px solid var(--line); color: var(--text); font-size: 15px; }
|
||||
.detail header button { border: 0; background: none; color: var(--muted); font-size: 20px; cursor: pointer; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
@@ -202,6 +208,7 @@ function setT(j) {
|
||||
document.getElementById("instant").textContent = `T = ${utc(D.times[T])}`;
|
||||
Plotly.relayout("grid", { shapes: [tLine()] });
|
||||
drawImage();
|
||||
opened.forEach(i => Plotly.relayout(`detail-plot-${i}`, { shapes: [tLine()] }));
|
||||
}
|
||||
|
||||
const columns = document.getElementById("columns");
|
||||
@@ -213,12 +220,64 @@ columns.addEventListener("click", ev => {
|
||||
markColumn();
|
||||
drawGrid();
|
||||
drawImage();
|
||||
opened.forEach(i => drawDetail(i));
|
||||
});
|
||||
|
||||
// Détail d'un capteur (spec §4, version 0) : la grandeur de la grille, puis error_value et son seuil ; T marqué.
|
||||
const opened = []; // index des capteurs dépliés, dans l'ordre d'ouverture
|
||||
function autoscale(plotId) {
|
||||
/*AUTOSCALE*/
|
||||
}
|
||||
|
||||
function detailFigure(i) {
|
||||
const s = S[i], ends = [D.times[0], D.times[D.times.length - 1]];
|
||||
return [[
|
||||
{ type: "scatter", mode: "lines", x: D.times, y: s.values[col], name: col, line: { color: "#2a78d6", width: 1.5 } },
|
||||
{ type: "scatter", mode: "lines", x: D.times, y: s.values.error_value, name: "error_value", yaxis: "y2",
|
||||
line: { color: "#d03b3b", width: 1.5 } },
|
||||
{ type: "scatter", mode: "lines", x: ends, y: [s.threshold, s.threshold], name: "error_threshold", yaxis: "y2",
|
||||
line: { color: "#d03b3b", width: 1, dash: "dash" }, hoverinfo: "skip" },
|
||||
], {
|
||||
height: 380, margin: { l: 60, r: 10, t: 30, b: 40 }, legend: { orientation: "h", x: 0, y: 1.12 },
|
||||
xaxis: { type: "date", anchor: "y2" },
|
||||
yaxis: { domain: [0.55, 1], fixedrange: true, title: { text: col } },
|
||||
yaxis2: { domain: [0, 0.45], fixedrange: true, title: { text: "error_value" } },
|
||||
shapes: [tLine()],
|
||||
}];
|
||||
}
|
||||
|
||||
function drawDetail(i) {
|
||||
const id = `detail-plot-${i}`;
|
||||
Plotly.purge(id);
|
||||
Plotly.newPlot(id, ...detailFigure(i), CONFIG).then(() => autoscale(id));
|
||||
}
|
||||
|
||||
function openDetail(i) {
|
||||
if (opened.includes(i)) return;
|
||||
opened.push(i);
|
||||
const box = document.createElement("div");
|
||||
box.className = "detail";
|
||||
box.innerHTML = `<header><b></b><button type="button" title="Close">×</button></header><div id="detail-plot-${i}"></div>`;
|
||||
box.querySelector("b").textContent = `${NAMES[i]} · ${S[i].kind}`;
|
||||
box.querySelector("button").addEventListener("click", () => {
|
||||
Plotly.purge(`detail-plot-${i}`);
|
||||
box.remove();
|
||||
opened.splice(opened.indexOf(i), 1);
|
||||
});
|
||||
document.getElementById("details").append(box);
|
||||
drawDetail(i);
|
||||
}
|
||||
|
||||
markColumn();
|
||||
document.getElementById("instant").textContent = `T = ${utc(D.times[T])}`;
|
||||
Promise.all([drawGrid(), drawImage()]).then(() => {
|
||||
document.getElementById("grid").on("plotly_click", ev => setT(ev.points[0].pointNumber[1]));
|
||||
document.getElementById("grid").on("plotly_click", ev => { // une case : T devient son instant, son capteur se déplie
|
||||
const [i, j] = ev.points[0].pointNumber;
|
||||
setT(j);
|
||||
openDetail(i);
|
||||
});
|
||||
document.getElementById("image").on("plotly_click", ev => openDetail(ev.points[0].customdata)); // un marqueur
|
||||
for (const name of (ASKED.get("open") || "").split(",")) if (NAMES.includes(name)) openDetail(NAMES.indexOf(name));
|
||||
});
|
||||
if (D.images.length) { // la taille de l'image, lue sur la première, place la photo sous les marqueurs
|
||||
const probe = new Image();
|
||||
|
||||
Reference in new issue
Block a user