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) {
150
150
function maybeChannels ( channels ) {
151
151
return Object . fromEntries (
152
152
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
154
154
if ( channel . filter === undefined && channel . scale == null ) channel = { ...channel , filter : null } ;
155
155
return [ name , channel ] ;
156
156
} )
Original file line number Diff line number Diff line change @@ -116,15 +116,16 @@ export class Tip extends Mark {
116
116
const widthof = monospace ? monospaceWidth : defaultWidth ;
117
117
const ee = widthof ( ellipsis ) ;
118
118
119
- // Initialize shorthand formats. TODO Don’t mutate.
119
+ // Promote shorthand string formats to functions . TODO Don’t mutate.
120
120
for ( const key in this . format ) {
121
121
const format = this . format [ key ] ;
122
122
if ( typeof format === "string" && key in sources ) {
123
123
this . format [ key ] = ( isTemporal ( sources [ key ] . value ) ? utcFormat : numberFormat ) ( format ) ;
124
124
}
125
125
}
126
126
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.
128
129
if ( index . fi != null ) {
129
130
const { fx, fy} = scales ;
130
131
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