@@ -134,7 +134,7 @@ function someFiltersActive(view) {
134
134
} ) ;
135
135
}
136
136
137
- function model ( layout , d , i ) {
137
+ function model ( layout , fullLayout , d , i ) {
138
138
var cd0 = unwrap ( d ) ;
139
139
var trace = cd0 . trace ;
140
140
var lineColor = helpers . convertTypedArray ( cd0 . lineColor ) ;
@@ -168,6 +168,16 @@ function model(layout, d, i) {
168
168
var rowContentWidth = groupWidth ;
169
169
var rowHeight = groupHeight ;
170
170
171
+ for ( var k = 0 ; k < dimensions . length ; k ++ ) {
172
+ var dim = dimensions [ k ] ;
173
+ dim . _ax = {
174
+ type : 'linear' ,
175
+ showexponent : 'all' ,
176
+ exponentformat : 'B'
177
+ } ;
178
+ Axes . setConvert ( dim . _ax , fullLayout ) ;
179
+ }
180
+
171
181
return {
172
182
key : i ,
173
183
colCount : dimensions . filter ( helpers . isVisible ) . length ,
@@ -378,39 +388,28 @@ function updatePanelLayout(yAxis, vm) {
378
388
}
379
389
}
380
390
381
- var linearAxis ;
382
-
383
- function linearFormat ( v , tickformat ) {
384
- linearAxis . tickformat = tickformat ;
385
-
386
- return Axes . tickText (
387
- linearAxis ,
388
- linearAxis . d2l ( v ) ,
389
- true
390
- ) . text ;
391
- }
392
-
393
- function extremeText ( d , isTop ) {
394
- if ( d . ordinal ) return '' ;
395
- var domain = d . domainScale . domain ( ) ;
396
- var v = ( domain [ isTop ? domain . length - 1 : 0 ] ) ;
397
- return linearFormat ( v , d . tickFormat ) ;
398
- }
399
-
400
391
module . exports = function parcoords ( gd , cdModule , layout , callbacks ) {
401
392
var state = parcoordsInteractionState ( ) ;
402
393
403
394
var fullLayout = gd . _fullLayout ;
404
395
var svg = fullLayout . _toppaper ;
405
396
var glContainer = fullLayout . _glcontainer ;
406
397
407
- // mock one linear axes for tick formatting
408
- linearAxis = { type : 'linear' , showexponent : 'all' , exponentformat : 'B' } ;
409
- Axes . setConvert ( linearAxis , fullLayout ) ;
398
+ function linearFormat ( dim , v ) {
399
+ return Axes . tickText ( dim . _ax , v , true ) . text ;
400
+ }
401
+
402
+ function extremeText ( d , i , isTop ) {
403
+ if ( d . ordinal ) return '' ;
404
+ var domain = d . domainScale . domain ( ) ;
405
+ var v = ( domain [ isTop ? domain . length - 1 : 0 ] ) ;
406
+
407
+ return linearFormat ( d . model . dimensions [ i ] , v ) ;
408
+ }
410
409
411
410
var vm = cdModule
412
411
. filter ( function ( d ) { return unwrap ( d ) . trace . visible ; } )
413
- . map ( model . bind ( 0 , layout ) )
412
+ . map ( model . bind ( 0 , layout , fullLayout ) )
414
413
. map ( viewModel . bind ( 0 , state , callbacks ) ) ;
415
414
416
415
glContainer . each ( function ( d , i ) {
@@ -590,7 +589,7 @@ module.exports = function parcoords(gd, cdModule, layout, callbacks) {
590
589
. classed ( c . cn . axis , true ) ;
591
590
592
591
axis
593
- . each ( function ( d ) {
592
+ . each ( function ( d , i ) {
594
593
var wantedTickCount = d . model . height / d . model . tickDistance ;
595
594
var scale = d . domainScale ;
596
595
var sdom = scale . domain ( ) ;
@@ -604,7 +603,7 @@ module.exports = function parcoords(gd, cdModule, layout, callbacks) {
604
603
sdom :
605
604
null )
606
605
. tickFormat ( function ( v ) {
607
- return d . ordinal ? v : linearFormat ( v , d . tickFormat ) ;
606
+ return helpers . isOrdinal ( d ) ? v : linearFormat ( d . model . dimensions [ i ] , v ) ;
608
607
} )
609
608
. scale ( scale ) ) ;
610
609
Drawing . font ( axis . selectAll ( 'text' ) , d . model . tickFont ) ;
@@ -693,7 +692,7 @@ module.exports = function parcoords(gd, cdModule, layout, callbacks) {
693
692
. call ( styleExtentTexts ) ;
694
693
695
694
axisExtentTopText
696
- . text ( function ( d ) { return extremeText ( d , true ) ; } )
695
+ . text ( function ( d , i ) { return extremeText ( d , i , true ) ; } )
697
696
. each ( function ( d ) { Drawing . font ( d3 . select ( this ) , d . model . rangeFont ) ; } ) ;
698
697
699
698
var axisExtentBottom = axisExtent . selectAll ( '.' + c . cn . axisExtentBottom )
@@ -718,7 +717,7 @@ module.exports = function parcoords(gd, cdModule, layout, callbacks) {
718
717
. call ( styleExtentTexts ) ;
719
718
720
719
axisExtentBottomText
721
- . text ( function ( d ) { return extremeText ( d ) ; } )
720
+ . text ( function ( d , i ) { return extremeText ( d , i , false ) ; } )
722
721
. each ( function ( d ) { Drawing . font ( d3 . select ( this ) , d . model . rangeFont ) ; } ) ;
723
722
724
723
brush . ensureAxisBrush ( axisOverlays ) ;
0 commit comments