File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -115,6 +115,14 @@ export function createScaleQ(
115
115
scale . interpolate ( interpolate ) ;
116
116
}
117
117
118
+ // If the zero option is not specified, then implicitly extend the domain to
119
+ // include zero if the minimum is less than 7% of the spread (and similarly
120
+ // for negative domains).
121
+ if ( zero === undefined && type === "linear" ) {
122
+ const [ min , max ] = extent ( domain ) ;
123
+ zero = min > 0 ? min < 0.07 * ( max - min ) : max < 0 ? max > 0.07 * ( min - max ) : false ;
124
+ }
125
+
118
126
// If a zero option is specified, we assume that the domain is numeric, and we
119
127
// want to ensure that the domain crosses zero. However, note that the domain
120
128
// may be reversed (descending) so we shouldn’t assume that the first value is
You can’t perform that action at this time.
0 commit comments