@@ -179,16 +179,10 @@ export function plot(options = {}) {
179179
180180 autoScaleLabels ( channelsByScale , scaleDescriptors , axes , dimensions , options ) ;
181181
182- // Compute value objects, applying scales as needed.
183- for ( const state of stateByMark . values ( ) ) {
184- state . values = valueObject ( state . channels , scales ) ;
185- }
186-
187- // Apply projection as needed.
188- if ( context . projection ) {
189- for ( const [ mark , state ] of stateByMark ) {
190- mark . project ( state . channels , state . values , context ) ;
191- }
182+ // Compute value objects, applying scales and projection as needed.
183+ for ( const [ mark , state ] of stateByMark ) {
184+ state . values = mark . scale ( state . channels , scales ) ;
185+ if ( context . projection ) mark . project ( state . channels , state . values , context ) ;
192186 }
193187
194188 const { width, height} = dimensions ;
@@ -421,6 +415,9 @@ export class Mark {
421415 maybeProject ( "x1" , "y1" , channels , values , context ) ;
422416 maybeProject ( "x2" , "y2" , channels , values , context ) ;
423417 }
418+ scale ( channels , scales ) {
419+ return valueObject ( channels , scales ) ;
420+ }
424421 plot ( { marks = [ ] , ...options } = { } ) {
425422 return plot ( { ...options , marks : [ ...marks , this ] } ) ;
426423 }
0 commit comments