Skip to content

Commit 7529eed

Browse files
authored
Adjust dot size to iterationCount (#356)
Gradually adjust scatter plot dot sizes from 5px down to 2px for iterationCount > 20.
1 parent 638a968 commit 7529eed

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

resources/metric-ui.mjs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,12 @@ function renderScatterPlot({ values, width = 500, height, trackHeight, xAxisPosi
239239
// Axis + labels height:
240240
const axisHeight = 18;
241241
const axisMarginY = 4;
242-
const markerSize = 5;
243242
const trackMargin = 2;
243+
let markerSize = 5;
244+
// Auto-adjust markers to [2px, 5px] for high iteration counts:
245+
const iterationsLimit = 20;
246+
if (values.length > iterationsLimit)
247+
markerSize = 2 + (3 / values.length) * iterationsLimit;
244248
// Recalculate height:
245249
if (height)
246250
trackHeight = (height - axisHeight - axisMarginY) / trackCount;

0 commit comments

Comments
 (0)