@@ -29,16 +29,12 @@ export function auto(data, {x, y, color, size, fx, fy, mark} = {}) {
2929 if ( isOptions ( fx ) ) ( { value : fx } = makeOptions ( fx ) ) ;
3030 if ( isOptions ( fy ) ) ( { value : fy } = makeOptions ( fy ) ) ;
3131
32- const { value : xValue } = x ;
33- const { value : yValue } = y ;
34- const { value : sizeValue } = size ;
35- const { value : colorValue , color : colorColor } = color ;
32+ let { value : xValue , reduce : xReduce , ... xOptions } = x ;
33+ let { value : yValue , reduce : yReduce , ... yOptions } = y ;
34+ let { value : sizeValue , reduce : sizeReduce } = size ;
35+ let { value : colorValue , color : colorColor , reduce : colorReduce } = color ;
3636
3737 // Determine the default reducer, if any.
38- let { reduce : xReduce } = x ;
39- let { reduce : yReduce } = y ;
40- let { reduce : sizeReduce } = size ;
41- let { reduce : colorReduce } = color ;
4238 if ( xReduce === undefined )
4339 xReduce = yReduce == null && xValue == null && sizeValue == null && yValue != null ? "count" : null ;
4440 if ( yReduce === undefined )
@@ -175,7 +171,11 @@ export function auto(data, {x, y, color, size, fx, fy, mark} = {}) {
175171 transform = isOrdinal ( y ) ? groupY : binY ;
176172 }
177173 }
178- if ( transform ) options = transform ( transformOptions , options ) ;
174+ if ( transform ) {
175+ if ( transform === bin || transform === binX ) options . x = { value : x , ...xOptions } ;
176+ if ( transform === bin || transform === binY ) options . y = { value : y , ...yOptions } ;
177+ options = transform ( transformOptions , options ) ;
178+ }
179179
180180 // If zero-ness is not specified, default based on whether the resolved mark
181181 // type will include a zero baseline.
0 commit comments