@@ -3,6 +3,7 @@ import {finite, positive} from "../defined.js";
33import { identity , maybeNamed , number , valueof } from "../options.js" ;
44import { coerceNumbers } from "../scales.js" ;
55import { initializer } from "./basic.js" ;
6+ import { Position } from "../projection.js" ;
67
78const anchorXLeft = ( { marginLeft} ) => [ 1 , marginLeft ] ;
89const anchorXRight = ( { width, marginRight} ) => [ - 1 , width - marginRight ] ;
@@ -67,9 +68,10 @@ function dodge(y, x, anchor, padding, options) {
6768 options = { ...options , channels : { r : { value : r , scale : "r" } , ...maybeNamed ( channels ) } } ;
6869 if ( sort === undefined && reverse === undefined ) options . sort = { channel : "r" , order : "descending" } ;
6970 }
70- return initializer ( options , function ( data , facets , { [ x ] : X , r : R } , scales , dimensions ) {
71- if ( ! X ) throw new Error ( `missing channel: ${ x } ` ) ;
72- X = coerceNumbers ( valueof ( X . value , scales [ X . scale ] || identity ) ) ;
71+ return initializer ( options , function ( data , facets , channels , scales , dimensions , context ) {
72+ let { [ x ] : X , r : R } = channels ;
73+ if ( ! channels [ x ] ) throw new Error ( `missing channel: ${ x } ` ) ;
74+ ( { [ x ] : X } = Position ( channels , scales , context ) ) ;
7375 const r = R ? undefined : this . r !== undefined ? this . r : options . r !== undefined ? number ( options . r ) : 3 ;
7476 if ( R ) R = coerceNumbers ( valueof ( R . value , scales [ R . scale ] || identity ) ) ;
7577 let [ ky , ty ] = anchor ( dimensions ) ;
0 commit comments