Skip to content

Commit 1a13de7

Browse files
committed
show single point in timeline
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 95a77f7 commit 1a13de7

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

codespeed/static/js/timeline.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,19 @@ function renderPlot(data) {
290290

291291
var lastHighlightPoints = null, lastHighlightX = null;
292292

293+
// When there's a single data point, xMin===xMax and Dygraph clips the dot
294+
// at the canvas edge. Compute an explicit dateWindow with padding.
295+
var singlePointWindow = null;
296+
if (built.data.length === 1) {
297+
var xVal = equidistant ? built.data[0][0] : built.data[0][0].getTime();
298+
if (equidistant) {
299+
singlePointWindow = [xVal - 1, xVal + 1];
300+
} else {
301+
var dayMs = 86400000;
302+
singlePointWindow = [new Date(xVal - dayMs), new Date(xVal + dayMs)];
303+
}
304+
}
305+
293306
plotInstance = new Dygraph(
294307
document.getElementById('plot'),
295308
built.data,
@@ -307,6 +320,7 @@ function renderPlot(data) {
307320
y: { valueRange: [0, null] }
308321
},
309322
xRangePad: 20,
323+
dateWindow: singlePointWindow,
310324
connectSeparatedPoints: true,
311325
underlayCallback: function(canvas, area, g) {
312326
versionBoundaries.forEach(function(b) {

0 commit comments

Comments
 (0)