Skip to content

Commit

Permalink
Adjust dot size to iterationCount (WebKit#356)
Browse files Browse the repository at this point in the history
Gradually adjust scatter plot dot sizes from 5px down to 2px for iterationCount > 20.
  • Loading branch information
camillobruni committed Jan 25, 2024
1 parent 638a968 commit 7529eed
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion resources/metric-ui.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,12 @@ function renderScatterPlot({ values, width = 500, height, trackHeight, xAxisPosi
// Axis + labels height:
const axisHeight = 18;
const axisMarginY = 4;
const markerSize = 5;
const trackMargin = 2;
let markerSize = 5;
// Auto-adjust markers to [2px, 5px] for high iteration counts:
const iterationsLimit = 20;
if (values.length > iterationsLimit)
markerSize = 2 + (3 / values.length) * iterationsLimit;
// Recalculate height:
if (height)
trackHeight = (height - axisHeight - axisMarginY) / trackCount;
Expand Down

0 comments on commit 7529eed

Please sign in to comment.