@@ -59,7 +59,7 @@ class IntervalBrushFilter implements AxisBrushFilter {
59
59
lower : number ,
60
60
upper : number ,
61
61
lowerOpen : boolean ,
62
- upperOpen : boolean
62
+ upperOpen : boolean ,
63
63
) {
64
64
this . _lower = lower ;
65
65
this . _upper = upper ;
@@ -121,7 +121,7 @@ export class Axis {
121
121
svgProps : tf_hparams_parallel_coords_plot_interaction_manager . SVGProperties ,
122
122
schema : Schema ,
123
123
interactionManager : tf_hparams_parallel_coords_plot_interaction_manager . InteractionManager ,
124
- colIndex : number
124
+ colIndex : number ,
125
125
) {
126
126
this . _svgProps = svgProps ;
127
127
this . _schema = schema ;
@@ -152,7 +152,7 @@ export class Axis {
152
152
this . _brushFilter = this . _buildBrushFilter (
153
153
this . brushSelection ( ) ! ,
154
154
this . scaleType ( ) ! ,
155
- this . yScale ( )
155
+ this . yScale ( ) ,
156
156
) ;
157
157
}
158
158
/**
@@ -165,7 +165,7 @@ export class Axis {
165
165
// Pass a copy since createAxisScale may permute the domainValues array.
166
166
domainValues . slice ( ) ,
167
167
this . _svgProps . height ,
168
- this . scaleType ( )
168
+ this . scaleType ( ) ,
169
169
) ;
170
170
// TODO(erez): Try to modify the brush selection so that it selects
171
171
// the same subset of the axis domain which was selected before
@@ -181,7 +181,7 @@ export class Axis {
181
181
this . _brushFilter = this . _buildBrushFilter (
182
182
this . brushSelection ( ) ! ,
183
183
this . scaleType ( ) ! ,
184
- this . yScale ( )
184
+ this . yScale ( ) ,
185
185
) ;
186
186
}
187
187
public brushFilter ( ) : AxisBrushFilter {
@@ -216,7 +216,7 @@ export class Axis {
216
216
. style ( 'text-anchor' , 'middle' )
217
217
. attr ( 'y' , - 9 )
218
218
. text ( ( colIndex ) =>
219
- tf_hparams_utils . schemaColumnName ( this . _schema , colIndex )
219
+ tf_hparams_utils . schemaColumnName ( this . _schema , colIndex ) ,
220
220
) ;
221
221
// Add dragging event handlers.
222
222
axisParentSel . call (
@@ -233,7 +233,7 @@ export class Axis {
233
233
. on ( 'end' , ( ) => {
234
234
this . _interactionManager . onDragEnd ( ) ;
235
235
axisParent . removeAttribute ( 'is-dragging' ) ;
236
- } )
236
+ } ) ,
237
237
) ;
238
238
// Add the brush.
239
239
const d3Brush = d3
@@ -259,7 +259,7 @@ export class Axis {
259
259
axisParent . setAttribute ( 'is-brushing' , '' ) ;
260
260
this . _interactionManager . onBrushChanged (
261
261
this . colIndex ( ) ,
262
- d3 . event . selection
262
+ d3 . event . selection ,
263
263
) ;
264
264
} )
265
265
. on ( 'brush' , ( ) => {
@@ -268,7 +268,7 @@ export class Axis {
268
268
}
269
269
this . _interactionManager . onBrushChanged (
270
270
this . colIndex ( ) ,
271
- d3 . event . selection
271
+ d3 . event . selection ,
272
272
) ;
273
273
} )
274
274
. on ( 'end' , ( ) => {
@@ -277,7 +277,7 @@ export class Axis {
277
277
}
278
278
this . _interactionManager . onBrushChanged (
279
279
this . colIndex ( ) ,
280
- d3 . event . selection
280
+ d3 . event . selection ,
281
281
) ;
282
282
axisParent . removeAttribute ( 'is-brushing' ) ;
283
283
} ) ;
@@ -301,15 +301,15 @@ export class Axis {
301
301
private _buildBrushFilter (
302
302
brushSelection : d3 . BrushSelection ,
303
303
scaleType : ScaleType ,
304
- yScale : any /* D3 scale */
304
+ yScale : any /* D3 scale */ ,
305
305
) {
306
306
if ( brushSelection === null ) {
307
307
return new AlwaysPassingBrushFilter ( ) ;
308
308
}
309
309
if ( scaleType === null ) {
310
310
console . error (
311
311
"Scale type is null, but brushSelection isn't: " ,
312
- brushSelection
312
+ brushSelection ,
313
313
) ;
314
314
return new AlwaysPassingBrushFilter ( ) ;
315
315
}
@@ -321,36 +321,36 @@ export class Axis {
321
321
tf_hparams_parallel_coords_plot_utils . continuousScaleInverseImage (
322
322
yScale ,
323
323
brushSelection [ 0 ] ,
324
- brushSelection [ 1 ]
324
+ brushSelection [ 1 ] ,
325
325
) ;
326
326
return new IntervalBrushFilter (
327
327
lower ,
328
328
upper ,
329
329
/*lowerOpen=*/ false ,
330
- /*upperOpen=*/ false
330
+ /*upperOpen=*/ false ,
331
331
) ;
332
332
}
333
333
case ScaleType . QUANTILE : {
334
334
const [ lower , upper ] =
335
335
tf_hparams_parallel_coords_plot_utils . quantileScaleInverseImage (
336
336
yScale ,
337
337
brushSelection [ 0 ] ,
338
- brushSelection [ 1 ]
338
+ brushSelection [ 1 ] ,
339
339
) ;
340
340
return new IntervalBrushFilter (
341
341
lower as number ,
342
342
upper as number ,
343
343
/*lowerOpen=*/ false ,
344
- /*upperOpen=*/ true
344
+ /*upperOpen=*/ true ,
345
345
) ;
346
346
}
347
347
case ScaleType . NON_NUMERIC :
348
348
return new SetBrushFilter (
349
349
tf_hparams_parallel_coords_plot_utils . pointScaleInverseImage (
350
350
yScale ,
351
351
brushSelection [ 0 ] ,
352
- brushSelection [ 1 ]
353
- )
352
+ brushSelection [ 1 ] ,
353
+ ) ,
354
354
) ;
355
355
}
356
356
console . error ( 'Unknown scale type: ' , scaleType ) ;
@@ -375,7 +375,7 @@ export class AxesCollection {
375
375
public constructor (
376
376
svgProps : tf_hparams_parallel_coords_plot_interaction_manager . SVGProperties ,
377
377
schema : Schema ,
378
- interactionManager : tf_hparams_parallel_coords_plot_interaction_manager . InteractionManager
378
+ interactionManager : tf_hparams_parallel_coords_plot_interaction_manager . InteractionManager ,
379
379
) {
380
380
this . _svgProps = svgProps ;
381
381
this . _schema = schema ;
@@ -396,7 +396,7 @@ export class AxesCollection {
396
396
*/
397
397
public updateAxes (
398
398
options : any ,
399
- sessionGroups : tf_hparams_api . SessionGroup [ ]
399
+ sessionGroups : tf_hparams_api . SessionGroup [ ] ,
400
400
) {
401
401
console . assert ( ! this . isAxisDragging ( ) ) ;
402
402
// Traverse options.columns, and update each corresponding axis.
@@ -406,7 +406,7 @@ export class AxesCollection {
406
406
let axis = this . _axes [ colIndex ] ;
407
407
axis . setDisplayed ( true ) ;
408
408
const domainValues = sessionGroups . map ( ( sg ) =>
409
- tf_hparams_utils . columnValueByIndex ( this . _schema , sg , colIndex )
409
+ tf_hparams_utils . columnValueByIndex ( this . _schema , sg , colIndex ) ,
410
410
) ;
411
411
axis . setDomainAndScale ( domainValues , column . scale ) ;
412
412
visibleColIndices . add ( colIndex ) ;
@@ -421,7 +421,7 @@ export class AxesCollection {
421
421
// Update the DOM.
422
422
this . _parentsSel = this . _parentsSel . data (
423
423
Array . from ( visibleColIndices ) ,
424
- /*key=*/ ( colIndex ) => colIndex
424
+ /*key=*/ ( colIndex ) => colIndex ,
425
425
) ;
426
426
this . _parentsSel . exit ( ) . remove ( ) ;
427
427
this . _parentsSel = this . _parentsSel
@@ -447,7 +447,7 @@ export class AxesCollection {
447
447
return this . _stationaryAxesPositions
448
448
. domain ( )
449
449
. map ( ( colIndex ) =>
450
- mapFunction ( this . getAxisPosition ( colIndex ) , this . _axes [ colIndex ] )
450
+ mapFunction ( this . getAxisPosition ( colIndex ) , this . _axes [ colIndex ] ) ,
451
451
) ;
452
452
}
453
453
/**
@@ -456,12 +456,12 @@ export class AxesCollection {
456
456
* the first time it returns false.
457
457
*/
458
458
public allVisibleAxesSatisfy (
459
- predicate : ( xPosition , axis ) => boolean
459
+ predicate : ( xPosition , axis ) => boolean ,
460
460
) : boolean {
461
461
return this . _stationaryAxesPositions
462
462
. domain ( )
463
463
. every ( ( colIndex ) =>
464
- predicate ( this . getAxisPosition ( colIndex ) , this . _axes [ colIndex ] )
464
+ predicate ( this . getAxisPosition ( colIndex ) , this . _axes [ colIndex ] ) ,
465
465
) ;
466
466
}
467
467
public getAxisForColIndex ( colIndex : number ) : Axis {
@@ -490,7 +490,7 @@ export class AxesCollection {
490
490
this . _draggedAxisPosition = newX ;
491
491
let visibleColIndices = this . _stationaryAxesPositions . domain ( ) ;
492
492
visibleColIndices . sort (
493
- ( ci1 , ci2 ) => this . getAxisPosition ( ci1 ) - this . getAxisPosition ( ci2 )
493
+ ( ci1 , ci2 ) => this . getAxisPosition ( ci1 ) - this . getAxisPosition ( ci2 ) ,
494
494
) ;
495
495
this . _stationaryAxesPositions . domain ( visibleColIndices ) ;
496
496
this . _updateAxesPositionsInDOM ( this . _parentsSel ) ;
@@ -500,7 +500,7 @@ export class AxesCollection {
500
500
this . _draggedAxisPosition = null ;
501
501
this . _draggedAxis = null ;
502
502
this . _updateAxesPositionsInDOM (
503
- this . _parentsSel . transition ( ) . duration ( duration )
503
+ this . _parentsSel . transition ( ) . duration ( duration ) ,
504
504
) ;
505
505
}
506
506
public isAxisDragging ( ) : boolean {
@@ -509,7 +509,11 @@ export class AxesCollection {
509
509
public getAxisPosition ( colIndex : number ) : number {
510
510
return this . _draggedAxis !== null &&
511
511
this . _draggedAxis . colIndex ( ) === colIndex
512
- ? this . _draggedAxisPosition
512
+ ? // TODO: go/ts58upgrade - Fix type mismatch caused by improved checking
513
+ // of returned conditional operators after upgrade
514
+ // TS2322: Type 'number | null' is not assignable to type 'number'.
515
+ // @ts -ignore
516
+ this . _draggedAxisPosition
513
517
: this . _stationaryAxesPositions ( colIndex ) ;
514
518
}
515
519
/**
@@ -531,23 +535,23 @@ export class AxesCollection {
531
535
. domain ( )
532
536
. filter ( ( colIndex ) => visibleColIndices . has ( colIndex ) ) ;
533
537
const newDomain = Array . from (
534
- new Set ( [ ...visibleDomain , ...Array . from ( visibleColIndices ) ] )
538
+ new Set ( [ ...visibleDomain , ...Array . from ( visibleColIndices ) ] ) ,
535
539
) ;
536
540
this . _stationaryAxesPositions . domain ( newDomain ) ;
537
541
}
538
542
private _updateAxesPositionsInDOM ( selectionOrTransition ) {
539
543
selectionOrTransition . attr ( 'transform' , ( colIndex ) =>
540
- tf_hparams_utils . translateStr ( this . getAxisPosition ( colIndex ) )
544
+ tf_hparams_utils . translateStr ( this . getAxisPosition ( colIndex ) ) ,
541
545
) ;
542
546
}
543
547
private _createAxes (
544
- interactionManager : tf_hparams_parallel_coords_plot_interaction_manager . InteractionManager
548
+ interactionManager : tf_hparams_parallel_coords_plot_interaction_manager . InteractionManager ,
545
549
) : Axis [ ] {
546
550
return d3
547
551
. range ( tf_hparams_utils . numColumns ( this . _schema ) )
548
552
. map (
549
553
( colIndex ) =>
550
- new Axis ( this . _svgProps , this . _schema , interactionManager , colIndex )
554
+ new Axis ( this . _svgProps , this . _schema , interactionManager , colIndex ) ,
551
555
) ;
552
556
}
553
557
private _svgProps : tf_hparams_parallel_coords_plot_interaction_manager . SVGProperties ;
0 commit comments