@@ -78,15 +78,10 @@ export function inferChannelScale(name, channel) {
78
78
// computed; i.e., if the scale’s domain is set explicitly, that takes priority
79
79
// over the sort option, and we don’t need to do additional work.
80
80
export function channelDomain ( data , facets , channels , facetChannels , options ) {
81
+ const { order : defaultOrder , reverse : defaultReverse , reduce : defaultReduce = true , limit : defaultLimit } = options ;
81
82
for ( const x in options ) {
82
83
if ( ! registry . has ( x ) ) continue ; // ignore unknown scale keys (including generic options)
83
- let {
84
- value : y ,
85
- order = options . order ,
86
- reverse = options . reverse ,
87
- reduce = options . reduce === undefined ? true : options . reduce ,
88
- limit = options . limit
89
- } = maybeValue ( options [ x ] ) ;
84
+ let { value : y , order = defaultOrder , reverse = defaultReverse , reduce = defaultReduce , limit = defaultLimit } = maybeValue ( options [ x ] ) ; // prettier-ignore
90
85
order = order === undefined ? y === "width" || y === "height" ? descendingGroup : ascendingGroup : maybeOrder ( order ) ; // prettier-ignore
91
86
if ( reduce == null || reduce === false ) continue ; // disabled reducer
92
87
const X = x === "fx" || x === "fy" ? reindexFacetChannel ( facets , facetChannels [ x ] ) : findScaleChannel ( channels , x ) ;
@@ -161,7 +156,7 @@ function values(channels, name, alias) {
161
156
}
162
157
163
158
function maybeOrder ( order ) {
164
- if ( typeof order === "function" ) return order ;
159
+ if ( order == null || typeof order === "function" ) return order ;
165
160
switch ( `${ order } ` . toLowerCase ( ) ) {
166
161
case "ascending" :
167
162
return ascendingGroup ;
0 commit comments