File tree Expand file tree Collapse file tree 2 files changed +4
-3
lines changed
Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -150,7 +150,7 @@ export function composeRender(r1, r2) {
150150function maybeChannels ( channels ) {
151151 return Object . fromEntries (
152152 Object . entries ( maybeNamed ( channels ) ) . map ( ( [ name , channel ] ) => {
153- channel = maybeValue ( channel ) ;
153+ channel = typeof channel === "string" ? { value : channel , label : name } : maybeValue ( channel ) ; // for shorthand extra channels, use name as label
154154 if ( channel . filter === undefined && channel . scale == null ) channel = { ...channel , filter : null } ;
155155 return [ name , channel ] ;
156156 } )
Original file line number Diff line number Diff line change @@ -116,15 +116,16 @@ export class Tip extends Mark {
116116 const widthof = monospace ? monospaceWidth : defaultWidth ;
117117 const ee = widthof ( ellipsis ) ;
118118
119- // Initialize shorthand formats. TODO Don’t mutate.
119+ // Promote shorthand string formats to functions . TODO Don’t mutate.
120120 for ( const key in this . format ) {
121121 const format = this . format [ key ] ;
122122 if ( typeof format === "string" && key in sources ) {
123123 this . format [ key ] = ( isTemporal ( sources [ key ] . value ) ? utcFormat : numberFormat ) ( format ) ;
124124 }
125125 }
126126
127- // Initialize default formats for the facet scales. TODO Don’t mutate.
127+ // Borrow the scale tick format for facet channels; this is generally better
128+ // than the default format (and safe for ordinal scales). TODO Don’t mutate.
128129 if ( index . fi != null ) {
129130 const { fx, fy} = scales ;
130131 if ( fx && this . format . fx === undefined ) this . format . fx = inferTickFormat ( fx , fx . domain ( ) ) ;
You can’t perform that action at this time.
0 commit comments