Skip to content

Commit 3048d77

Browse files
committed
time-series figures show last 30 days
1 parent 4713f68 commit 3048d77

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

src/supercomputers/polaris/index.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,21 @@ const latency_busy_spin = Generators.input(latencyBusySpinInput);
115115
```js
116116
// Filter latency data based on busy_spin
117117
const filteredLatencyData = latencyData.filter(d => d.busy_spin === latency_busy_spin);
118+
119+
// Calculate 30-day range ending at latest date
120+
const latestLatencyDate = latencyData.length > 0
121+
? new Date(Math.max(...latencyData.map(d => new Date(d.date))))
122+
: new Date();
123+
const thirtyDaysAgo = new Date(latestLatencyDate);
124+
thirtyDaysAgo.setDate(thirtyDaysAgo.getDate() - 30);
118125
```
119126

120127
```js
121128
Plot.plot({
122129
marks: [
123130
Plot.rectY(filteredLatencyData, {x: "date", y: d => d.med * 1e6, fill: "coral", interval: "day"})
124131
],
125-
x: {type: "utc", label: "Date", nice: true},
132+
x: {type: "utc", label: "Date", domain: [thirtyDaysAgo, latestLatencyDate]},
126133
y: {label: "Latency (μs)"},
127134
width: 800,
128135
height: 400,
@@ -171,14 +178,21 @@ const filteredBandwidthData = bandwidthData.filter(d =>
171178
d.busy_spin === busy_spin &&
172179
d.xfer_size === xfer_size
173180
);
181+
182+
// Calculate 30-day range ending at latest date
183+
const latestBandwidthDate = bandwidthData.length > 0
184+
? new Date(Math.max(...bandwidthData.map(d => new Date(d.date))))
185+
: new Date();
186+
const thirtyDaysAgoBandwidth = new Date(latestBandwidthDate);
187+
thirtyDaysAgoBandwidth.setDate(thirtyDaysAgoBandwidth.getDate() - 30);
174188
```
175189

176190
```js
177191
Plot.plot({
178192
marks: [
179193
Plot.rectY(filteredBandwidthData, {x: "date", y: d => d["MiB/s"] / 1024, fill: "green", interval: "day"})
180194
],
181-
x: {type: "utc", label: "Date", nice: true},
195+
x: {type: "utc", label: "Date", domain: [thirtyDaysAgoBandwidth, latestBandwidthDate]},
182196
y: {label: "Throughput (GiB/s)"},
183197
width: 800,
184198
height: 400,

0 commit comments

Comments
 (0)