Skip to content

Commit 0cc04e8

Browse files
authored
limit maximum default radius (#568)
1 parent 7b3bd48 commit 0cc04e8

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/scales/quantitative.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,13 @@ function inferZeroDomain(channels) {
173173
}
174174

175175
// We don’t want the upper bound of the radial domain to be zero, as this would
176-
// be degenerate, so we ignore nonpositive values.
176+
// be degenerate, so we ignore nonpositive values. We also don’t want the maximum
177+
// default radius to exceed 30px.
177178
function inferRadialRange(channels, domain) {
178179
const h25 = quantile(channels, 0.5, ({value}) => value === undefined ? NaN : quantile(value, 0.25, positive));
179-
return domain.map(d => 3 * Math.sqrt(d / h25));
180+
const range = domain.map(d => 3 * Math.sqrt(d / h25));
181+
const k = 30 / max(range);
182+
return k < 1 ? range.map(r => r * k) : range;
180183
}
181184

182185
function inferLogDomain(channels) {

0 commit comments

Comments
 (0)