Skip to content

Commit 92bc848

Browse files
committed
expand when only one graph is selected
1 parent de7ce9e commit 92bc848

File tree

4 files changed

+26
-3
lines changed

4 files changed

+26
-3
lines changed

site/frontend/src/graph/render.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,8 @@ function normalizeData(data: CompileGraphData) {
400400
export type GraphRenderOpts = {
401401
// Width of the graph
402402
width: number;
403+
// Height of the graph
404+
height: number;
403405
// Render a title above the graph
404406
renderTitle?: boolean;
405407
// Function that can be used to hook into the rendering process
@@ -417,6 +419,7 @@ export function renderPlots(
417419
const renderTitle = opts.renderTitle ?? true;
418420
const hooks = opts.hooks ?? {};
419421
const width = opts.width;
422+
const height = opts.height;
420423

421424
normalizeData(data);
422425

@@ -504,7 +507,7 @@ export function renderPlots(
504507

505508
let plotOpts = genPlotOpts({
506509
width,
507-
height: 300,
510+
height: height ?? 300,
508511
yAxisLabel,
509512
series: seriesOpts,
510513
commits: data.commits,

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ async function renderGraph(
120120
) {
121121
const opts: GraphRenderOpts = {
122122
width: Math.min(window.innerWidth - 40, 465),
123+
height: 300,
123124
renderTitle: false,
124125
};
125126
if (date !== null) {

site/frontend/src/pages/compare/runtime/benchmark-detail-graph.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ async function renderGraph(
109109
) {
110110
const opts: GraphRenderOpts = {
111111
width: Math.min(window.innerWidth - 40, 465),
112+
height: 300,
112113
renderTitle: false,
113114
};
114115
if (date !== null) {

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

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,26 @@ async function loadGraphData(selector: GraphsSelector, loading: Ref<boolean>) {
6868
// Then draw the plots.
6969
await nextTick();
7070
71-
const width = Math.max(Math.floor(window.innerWidth / 4) - 40, 380);
72-
const opts = {width};
71+
const countGraphs = Object.keys(graphData.benchmarks)
72+
.map((benchmark) => Object.keys(graphData.benchmarks[benchmark]).length)
73+
.reduce((sum, item) => sum + item, 0);
74+
75+
const columns = countGraphs === 1 ? 1 : 4;
76+
77+
const root = document.getElementById("app")!;
78+
const width = Math.max(Math.floor(root.clientWidth / columns), 380);
79+
80+
const bodyEl = document.querySelector("body.container")!;
81+
const chartsEl = document.getElementById("charts")!;
82+
const height =
83+
countGraphs === 1
84+
? window.innerHeight - bodyEl.clientHeight + chartsEl.clientHeight - 60
85+
: 300;
86+
87+
const opts = {
88+
width,
89+
height,
90+
};
7391
7492
// If we select a smaller subset of benchmarks, then just show them.
7593
if (hasSpecificSelection(selector)) {

0 commit comments

Comments
 (0)