diff --git a/app/web/src/pages/Data.jsx b/app/web/src/pages/Data.jsx
index fd4ed52..d1d8290 100644
--- a/app/web/src/pages/Data.jsx
+++ b/app/web/src/pages/Data.jsx
@@ -45,9 +45,10 @@ export default function Data({ selection, choose, analysis, setAnalysis }) {
// all; otherwise the detectors run again without the others)
const [source, setSource] = useState("detectors"), [families, setFamilies] = useState(DETECTED), [targets, setTargets] = useState("");
const [focus, setFocus] = useState(false); // with an event open, the plots show only its sensors
+ const [hidden, setHidden] = useState([]); // the targets removed from the plots (the detectors still read them)
const { station, start, end } = selection;
useEffect(() => {
- setData(null); setTargets("");
+ setData(null); setTargets(""); setHidden([]);
if (!station) return;
setLoading(true);
call(`/api/curves?${new URLSearchParams({ station, start, end })}`).then(d => { setData(d); setLoading(false); });
@@ -66,8 +67,9 @@ export default function Data({ selection, choose, analysis, setAnalysis }) {
{loading && }
+ {data && }
{data && setMoment({ t, nearest })}
- source={source} setSource={setSource} families={families} targets={targets} focus={focus}
+ source={source} setSource={setSource} families={families} targets={targets} focus={focus} hidden={hidden}
analysis={analysis} setAnalysis={setAnalysis} />}
@@ -85,6 +87,28 @@ export default function Data({ selection, choose, analysis, setAnalysis }) {
);
}
+// The targets shown on the plots, at once; the others are removed from them, not from the detectors
+function TargetFilter({ d, hidden, setHidden }) {
+ const sensors = Object.keys(d.T).filter(k => k && !k.startsWith("system:"));
+ const refs = new Set(d.plots.flatMap(p => p.traces).filter(t => t.name.endsWith(" (ref.)")).map(t => t.t));
+ return (
+
+
+ !hidden.includes(s))}
+ onChange={v => setHidden(sensors.filter(s => !v.includes(s)))}>
+
+ {sensors.map(c => )}
+
+
+
+
+
+
+
+ );
+}
+
// The families apply at once (filter of the page, Detectors and LLM); the targets, with the button: each set of targets
// runs the detectors again (the LLM labels do not state their sensors: they do not filter them)
function Settings({ d, families, setFamilies, targets, setTargets, detect, focus, setFocus }) {
@@ -131,7 +155,7 @@ const mentions = (text, s) => new RegExp(`(^|[^\\w])${s.replace(/[^\w]/g, "\\$&"
const sensorsOf = (l, names) => l.sensors ?? names.filter(s => mentions(l.description, s));
// analysis: the folder of the analysis shown, held by App (the sidebar opens one)
-function Curves({ selection: { station, start, end }, d, setImage, source, setSource, families, targets, focus, analysis, setAnalysis }) {
+function Curves({ selection: { station, start, end }, d, setImage, source, setSource, families, targets, focus, hidden, analysis, setAnalysis }) {
const { A, B, T, plots: PLOTS } = d;
const plotIndex = (title, otherwise) => { const i = PLOTS.findIndex(p => p.title === title); return i < 0 ? otherwise : i; };
const [Plotly, setPlotly] = useState(null), [ready, setReady] = useState(false);
@@ -150,7 +174,7 @@ function Curves({ selection: { station, start, end }, d, setImage, source, setSo
// the focus: the sensors of the open event (none: all, as for No data); shown, their key
const names = useMemo(() => Object.keys(T).filter(k => k && !k.startsWith("system:")), [T]);
const kept = focus && opened ? sensorsOf(opened, names) : [], shown = kept.join(",");
- current.current = { views, labels, choice, opened, open, kept: new Set(kept), shown, c: THEMES[dark ? "dark" : "light"] }; // what the Plotly events read
+ current.current = { views, labels, choice, opened, open, kept: new Set(kept), shown, hidden: new Set(hidden), c: THEMES[dark ? "dark" : "light"] }; // what the Plotly events read
useEffect(() => { import("plotly.js-dist-min").then(m => setPlotly(() => m.default)); }, []);
@@ -214,11 +238,11 @@ function Curves({ selection: { station, start, end }, d, setImage, source, setSo
}
function drawFig(g, m) {
- const p = PLOTS[m], { c } = current.current, b = bar.current?._fullLayout;
+ const p = PLOTS[m], { c, hidden } = current.current, b = bar.current?._fullLayout;
g.style.height = `${HEIGHT}px`; // responsive: Plotly takes the height of the div again at each restyle, it needs one
// uirevision: the zoom and the hidden sensors stay when the plot changes; the y axis, specific to each plot, refits.
// A new plot takes the range already shown. t: the room for the plot menu (left) and the toolbar (right).
- return Plotly.react(g, p.traces.map(t => ({ type: "scatter", mode: t.mode || "lines", marker: { size: 4 }, x: T[t.t], y: t.y, name: t.name,
+ return Plotly.react(g, p.traces.filter(t => !hidden.has(t.t)).map(t => ({ type: "scatter", mode: t.mode || "lines", marker: { size: 4 }, x: T[t.t], y: t.y, name: t.name,
uid: t.name.replace(/\W/g, "_"), line: t.line, ...focusTrace(t),
hovertemplate: `${t.name}: %{y}
%{x|%Y-%m-%d %H:%M} UTC` })),
{ ...skin(c), height: HEIGHT, hovermode: "closest", margin: { ...margin(), t: 42, b: 36 }, uirevision: 1, shapes: zones(),
@@ -299,7 +323,7 @@ function Curves({ selection: { station, start, end }, d, setImage, source, setSo
// Drag on the bar: select a range (Analysis), otherwise zoom in time
useEffect(() => { if (ready) Plotly.relayout(bar.current, { dragmode: readOnly ? "zoom" : "select", selections: [] }); }, [ready, readOnly]);
useEffect(() => { if (ready) drawPlots(true).then(drawBar); }, [dark]);
- useEffect(() => { if (ready) drawPlots(true); }, [shown]);
+ useEffect(() => { if (ready) drawPlots(true); }, [shown, hidden]);
useEffect(() => { if (ready) plotDivs().forEach(g => Plotly.relayout(g, { shapes: zones() })); }, [ready, labels, choice, opened]);
useEffect(() => {
if (!ready || !bar.current._fullLayout) return;
diff --git a/app/web/src/pages/Images.jsx b/app/web/src/pages/Images.jsx
index 4b74d7e..61560b1 100644
--- a/app/web/src/pages/Images.jsx
+++ b/app/web/src/pages/Images.jsx
@@ -70,7 +70,7 @@ function Viewer({ station, d, compact, wide, toggle, moment }) {
-
+
{withPositions
? ○ Target ◌ Reference
: x, y are not positions in the image on this station}