@@ -148,7 +148,6 @@ function tooltipPlugin({
148
148
}
149
149
150
150
function genPlotOpts ( {
151
- title,
152
151
width,
153
152
height,
154
153
yAxisLabel,
@@ -161,7 +160,6 @@ function genPlotOpts({
161
160
absoluteMode,
162
161
} ) {
163
162
return {
164
- title,
165
163
width,
166
164
height,
167
165
series,
@@ -280,13 +278,20 @@ function normalizeData(data: GraphData) {
280
278
}
281
279
}
282
280
283
- // Renders the plots data with the given parameters from the `selector`, into a DOM node optionally
284
- // selected by the `elementSelector` query.
281
+ export type GraphRenderOpts = {
282
+ renderTitle ?: boolean ;
283
+ } ;
284
+
285
+ // Renders the plots data with the given parameters from the `selector` into
286
+ // the passed DOM element.
285
287
export function renderPlots (
286
288
data : GraphData ,
287
289
selector : GraphsSelector ,
288
- plotElement : HTMLElement
290
+ plotElement : HTMLElement ,
291
+ opts ?: GraphRenderOpts
289
292
) {
293
+ const renderTitle = opts ?. renderTitle ?? true ;
294
+
290
295
normalizeData ( data ) ;
291
296
292
297
const names = Object . keys ( data . benchmarks ) . sort ( ) ;
@@ -364,7 +369,6 @@ export function renderPlots(
364
369
cacheStates [ Object . keys ( cacheStates ) [ 0 ] ] . interpolated_indices ;
365
370
366
371
let plotOpts = genPlotOpts ( {
367
- title : benchName + "-" + benchKind ,
368
372
width : Math . floor ( window . innerWidth / 4 ) - 40 ,
369
373
height : 300 ,
370
374
yAxisLabel,
@@ -376,6 +380,9 @@ export function renderPlots(
376
380
} ,
377
381
absoluteMode : selector . kind == "raw" ,
378
382
} ) ;
383
+ if ( renderTitle ) {
384
+ plotOpts [ "title" ] = `${ benchName } -${ benchKind } ` ;
385
+ }
379
386
380
387
new uPlot ( plotOpts , plotData as any as TypedArray [ ] , plotElement ) ;
381
388
0 commit comments