@@ -52,19 +52,21 @@ axes.coerceRef = function(containerIn, containerOut, td, axLetter) {
52
52
// so we auto-set them again
53
53
axes . clearTypes = function ( gd , traces ) {
54
54
if ( ! Array . isArray ( traces ) || ! traces . length ) {
55
- traces = ( gd . _fullData ) . map ( function ( d , i ) { return i ; } ) ;
55
+ traces = ( gd . _fullData ) . map ( function ( d , i ) { return i ; } ) ;
56
56
}
57
57
traces . forEach ( function ( tracenum ) {
58
58
var trace = gd . data [ tracenum ] ;
59
- delete ( axes . getFromId ( gd , trace . xaxis ) || { } ) . type ;
60
- delete ( axes . getFromId ( gd , trace . yaxis ) || { } ) . type ;
59
+ delete ( axes . getFromId ( gd , trace . xaxis ) || { } ) . type ;
60
+ delete ( axes . getFromId ( gd , trace . yaxis ) || { } ) . type ;
61
61
} ) ;
62
62
} ;
63
63
64
64
// get counteraxis letter for this axis (name or id)
65
65
// this can also be used as the id for default counter axis
66
66
axes . counterLetter = function ( id ) {
67
- return { x :'y' , y :'x' } [ id . charAt ( 0 ) ] ;
67
+ var axLetter = id . charAt ( 0 ) ;
68
+ if ( axLetter === 'x' ) return 'y' ;
69
+ if ( axLetter === 'y' ) return 'x' ;
68
70
} ;
69
71
70
72
// incorporate a new minimum difference and first tick into
@@ -343,8 +345,8 @@ axes.autoBin = function(data,ax,nbins,is2d) {
343
345
datamax = Plotly . Lib . aggNums ( Math . max , null , data ) ;
344
346
if ( ax . type === 'category' ) {
345
347
return {
346
- start : datamin - 0.5 ,
347
- end : datamax + 0.5 ,
348
+ start : datamin - 0.5 ,
349
+ end : datamax + 0.5 ,
348
350
size : 1
349
351
} ;
350
352
}
@@ -457,12 +459,12 @@ axes.calcTicks = function calcTicks(ax) {
457
459
var nt = ax . nticks ,
458
460
minPx ;
459
461
if ( ! nt ) {
460
- if ( ax . type === 'category' ) {
462
+ if ( ax . type === 'category' ) {
461
463
minPx = ax . tickfont ? ( ax . tickfont . size || 12 ) * 1.2 : 15 ;
462
464
nt = ax . _length / minPx ;
463
465
}
464
466
else {
465
- minPx = ax . _id . charAt ( 0 ) === 'y' ? 40 : 80 ;
467
+ minPx = ax . _id . charAt ( 0 ) === 'y' ? 40 : 80 ;
466
468
nt = Plotly . Lib . constrain ( ax . _length / minPx , 4 , 9 ) + 1 ;
467
469
}
468
470
}
@@ -1417,7 +1419,7 @@ axes.doTicks = function(td, axid, skipTitle) {
1417
1419
var valsClipped = vals . filter ( clipEnds ) ;
1418
1420
1419
1421
function drawTicks ( container , tickpath ) {
1420
- var ticks = container . selectAll ( 'path.' + tcls )
1422
+ var ticks = container . selectAll ( 'path.' + tcls )
1421
1423
. data ( ax . ticks === 'inside' ? valsClipped : vals , datafn ) ;
1422
1424
if ( tickpath && ax . ticks ) {
1423
1425
ticks . enter ( ) . append ( 'path' ) . classed ( tcls , 1 ) . classed ( 'ticks' , 1 )
@@ -1431,7 +1433,7 @@ axes.doTicks = function(td, axid, skipTitle) {
1431
1433
else ticks . remove ( ) ;
1432
1434
}
1433
1435
1434
- function drawLabels ( container , position ) {
1436
+ function drawLabels ( container , position ) {
1435
1437
// tick labels - for now just the main labels.
1436
1438
// TODO: mirror labels, esp for subplots
1437
1439
var tickLabels = container . selectAll ( 'g.' + tcls ) . data ( vals , datafn ) ;
0 commit comments