@@ -74,26 +74,21 @@ function getGraphRange(artifact: ArtifactDescription): GraphRange {
74
74
}
75
75
76
76
/**
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 .
79
79
*/
80
80
function drawCurrentDate(opts : GraphRenderOpts , date : Date ) {
81
81
opts .hooks = {
82
82
drawSeries : (u : uPlot ) => {
83
83
let ctx = u .ctx ;
84
- ctx .save ();
85
-
86
- const y0 = u .bbox .top ;
87
- const y1 = y0 + u .bbox .height ;
88
84
const x = u .valToPos (date .getTime () / 1000 , " x" , true );
89
85
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.07)" ;
90
+ ctx .rect (x , u .bbox .top , u .bbox .width - x + u .bbox .left , u .bbox .height );
91
+ ctx .fill ();
97
92
ctx .restore ();
98
93
},
99
94
};
@@ -127,7 +122,7 @@ function getGraphTitle() {
127
122
const {start, end, date} = graphRange .value ;
128
123
const msg = ` ${DAY_RANGE } day history ` ;
129
124
if (date !== null ) {
130
- return ` ${msg } (${start } - ${end }) ` ;
125
+ return ` ${msg } (${start } → ${end }) ` ;
131
126
} else {
132
127
return ` ${msg } (up to benchmarked commit) ` ;
133
128
}
@@ -212,6 +207,10 @@ onMounted(() => renderGraph());
212
207
<div style =" font-size : 0.8em " >
213
208
Each plotted value is relative to its previous commit
214
209
</div >
210
+ <div style =" font-size : 0.8em " >
211
+ The shaded region shows values that are more recent than the
212
+ benchmarked commit
213
+ </div >
215
214
</div >
216
215
<div ref =" chartElement" ></div >
217
216
</div >
0 commit comments