Skip to content

Commit d7aa012

Browse files
committed
Receive element instead of a selector in renderPlots
1 parent 95cdac6 commit d7aa012

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

site/frontend/src/pages/graphs/page.vue

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,11 @@ async function loadGraphData(selector: GraphsSelector, loading: Ref<boolean>) {
7070
7171
// If we select a smaller subset of benchmarks, then just show them.
7272
if (hasSpecificSelection(selector)) {
73-
renderPlots(graphData, selector, "#charts");
73+
renderPlots(
74+
graphData,
75+
selector,
76+
document.querySelector<HTMLElement>("#charts")
77+
);
7478
} else {
7579
// If we select all of them, we expect that there will be a regular grid.
7680
@@ -81,15 +85,23 @@ async function loadGraphData(selector: GraphsSelector, loading: Ref<boolean>) {
8185
graphData,
8286
(benchName) => !benchName.endsWith("-tiny")
8387
);
84-
renderPlots(withoutTiny, selector, "#charts");
88+
renderPlots(
89+
withoutTiny,
90+
selector,
91+
document.querySelector<HTMLElement>("#charts")
92+
);
8593
8694
// Then, render only the size-related ones in their own dedicated section as they are less
8795
// important than having the better grouping. So, we only include the benchmarks ending in
8896
// "-tiny" and render them in the appropriate section.
8997
const onlyTiny = filterBenchmarks(graphData, (benchName) =>
9098
benchName.endsWith("-tiny")
9199
);
92-
renderPlots(onlyTiny, selector, "#size-charts");
100+
renderPlots(
101+
onlyTiny,
102+
selector,
103+
document.querySelector<HTMLElement>("#size-charts")
104+
);
93105
}
94106
}
95107

site/frontend/src/pages/graphs/plots.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ function normalizeData(data: GraphData) {
285285
export function renderPlots(
286286
data: GraphData,
287287
selector: GraphsSelector,
288-
elementSelector: string
288+
plotElement: HTMLElement
289289
) {
290290
normalizeData(data);
291291

@@ -377,11 +377,7 @@ export function renderPlots(
377377
absoluteMode: selector.kind == "raw",
378378
});
379379

380-
new uPlot(
381-
plotOpts,
382-
plotData as any as TypedArray[],
383-
document.querySelector<HTMLElement>(elementSelector)
384-
);
380+
new uPlot(plotOpts, plotData as any as TypedArray[], plotElement);
385381

386382
i++;
387383
}

0 commit comments

Comments
 (0)