File tree Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -109,6 +109,9 @@ export interface Channel {
109109 */
110110 filter ?: ( ( value : any ) => boolean ) | null ;
111111
112+ /** Whether to apply the scale’s transform, if any; defaults to true. */
113+ transform ?: boolean ;
114+
112115 /**
113116 * An internal hint to affect the default construction of scales. For example,
114117 * the dot mark uses a channel hint to affect the default range of the
Original file line number Diff line number Diff line change @@ -385,20 +385,20 @@ function applyScaleTransforms(channels, options) {
385385 return channels ;
386386}
387387
388- // Note: mutates channel.value to apply the scale transform, if any.
388+ // Note: mutates channel.value to apply the scale transform, if any. Also sets
389+ // channel.transform to false to prevent duplicate transform application.
389390function applyScaleTransform ( channel , options ) {
390- const { scale} = channel ;
391- if ( scale == null || channel . transformed ) return ;
391+ const { scale, transform : t = true } = channel ;
392+ if ( scale == null || ! t ) return ;
392393 const {
393394 type,
394395 percent,
395396 interval,
396397 transform = percent ? ( x ) => x * 100 : maybeIntervalTransform ( interval , type )
397398 } = options [ scale ] ?? { } ;
398- if ( transform != null ) {
399- channel . value = map ( channel . value , transform ) ;
400- channel . transformed = true ;
401- }
399+ if ( transform == null ) return ;
400+ channel . value = map ( channel . value , transform ) ;
401+ channel . transform = false ;
402402}
403403
404404// An initializer may generate channels without knowing how the downstream mark
You can’t perform that action at this time.
0 commit comments