@@ -115,14 +115,21 @@ const latency_busy_spin = Generators.input(latencyBusySpinInput);
115115``` js
116116// Filter latency data based on busy_spin
117117const 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
121128Plot .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
177191Plot .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