Skip to content

Commit 4cbbcb6

Browse files
committed
visualizer: enable graphs; unfortunately laggy
1 parent 29fa401 commit 4cbbcb6

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

visualizer/src/App.js

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,18 @@ const WidgetGrid = WidthProvider(GridLayout);
1616

1717
function Window(props) {
1818
const { title, children, sx } = props;
19+
const [ hidden, setHidden ] = useState(false);
20+
1921
return (
2022
<Card sx={{ width: "100%", height: "100%", display: "flex", flexDirection: "column", ...sx }}>
2123
<CardHeader className="windowResizeHandle" sx={{
2224
background: theme =>
2325
theme.palette.mode === "light"
2426
? theme.palette.grey[200]
2527
: theme.palette.grey[900],
26-
padding: "4px",
27-
}} subheader={title} subheaderTypographyProps={{ typography: "overline", marginLeft: 1 }}/>
28-
<CardContent sx={{ flexGrow: "1", padding: 1 }}>{ children }</CardContent>
28+
padding: "0px",
29+
}} subheader={<Button onClick={() => setHidden(hidden => !hidden)}>{title}</Button>} subheaderTypographyProps={{ typography: "overline", marginLeft: 0, }}/>
30+
<CardContent sx={{ flexGrow: "1", padding: 1 }}>{ !hidden ? children : null }</CardContent>
2931
</Card>
3032
);
3133
}
@@ -189,18 +191,18 @@ function App() {
189191
world: <Window title="World">
190192
<World state={realtimeState}/>
191193
</Window>,
192-
// tb1: <Window title="TB1 / Delta7">
193-
// <Plot name="tb1" data={[ {y: state?.layers.TB1, type: "line"} ]} layout={{ yaxis: { range: [0, 1] } }}/>
194-
// </Window>,
195-
// cpu4: <Window title="CPU4 / PFN">
196-
// <Plot name="cpu4" data={[ {y: state?.layers.CPU4, type: "line"} ]} layout={{ yaxis: { range: [0, 1] } }}/>
197-
// </Window>,
198-
// tn1: <Window title="TN1">
199-
// <Plot name="tn1" data={[ {y: state?.layers.TN1, type: "bar"} ]} layout={{ yaxis: { range: [0, 1] } }}/>
200-
// </Window>,
201-
// tn2: <Window title="TN2">
202-
// <Plot name="tn2" data={[ {y: state?.layers.TN2, type: "bar"} ]} layout={{ yaxis: { range: [0, 1] } }}/>
203-
// </Window>,
194+
tb1: <Window title="TB1 / Delta7">
195+
<Plot name="tb1" data={[ {y: state?.layers.TB1, type: "line"} ]} layout={{ yaxis: { range: [0, 1] } }}/>
196+
</Window>,
197+
cpu4: <Window title="CPU4 / PFN">
198+
<Plot name="cpu4" data={[ {y: state?.layers.CPU4, type: "line"} ]} layout={{ yaxis: { range: [0, 1] } }}/>
199+
</Window>,
200+
tn1: <Window title="TN1">
201+
<Plot name="tn1" data={[ {y: state?.layers.TN1, type: "bar"} ]} layout={{ yaxis: { range: [0, 1] } }}/>
202+
</Window>,
203+
tn2: <Window title="TN2">
204+
<Plot name="tn2" data={[ {y: state?.layers.TN2, type: "bar"} ]} layout={{ yaxis: { range: [0, 1] } }}/>
205+
</Window>,
204206
}), [realtimeState, state, readyState, sendJsonMessage]);
205207

206208
return (

0 commit comments

Comments
 (0)