Skip to content

Commit 05f5aa6

Browse files
committed
make future region in 30-day noise charts less obtrusive
by drawing it as a translucent region representing the "future"
1 parent 2f20131 commit 05f5aa6

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

site/frontend/src/pages/compare/compile/table/benchmark-detail.vue

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -74,26 +74,21 @@ function getGraphRange(artifact: ArtifactDescription): GraphRange {
7474
}
7575
7676
/**
77-
* Hook into the uPlot drawing machinery to draw a vertical line at the
78-
* position of the given `date`.
77+
* Hook into the uPlot drawing machinery to draw a rectangle from the `date` to
78+
* the end of the plot, representing the region that is the date's future.
7979
*/
8080
function drawCurrentDate(opts: GraphRenderOpts, date: Date) {
8181
opts.hooks = {
8282
drawSeries: (u: uPlot) => {
8383
let ctx = u.ctx;
84-
ctx.save();
85-
86-
const y0 = u.bbox.top;
87-
const y1 = y0 + u.bbox.height;
8884
const x = u.valToPos(date.getTime() / 1000, "x", true);
8985
90-
ctx.beginPath();
91-
ctx.moveTo(x, y0);
92-
ctx.strokeStyle = "red";
93-
ctx.setLineDash([5, 5]);
94-
ctx.lineTo(x, y1);
95-
ctx.stroke();
96-
86+
// Draw a translucent rectangle representing the region that is more
87+
// recent than `date`.
88+
ctx.save();
89+
ctx.fillStyle = "rgba(0, 0, 0, 0.03)";
90+
ctx.rect(x, u.bbox.top, u.bbox.width - x + u.bbox.left, u.bbox.height);
91+
ctx.fill();
9792
ctx.restore();
9893
},
9994
};

0 commit comments

Comments
 (0)