@@ -52,19 +52,21 @@ axes.coerceRef = function(containerIn, containerOut, td, axLetter) {
5252// so we auto-set them again
5353axes . clearTypes = function ( gd , traces ) {
5454 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 ; } ) ;
5656 }
5757 traces . forEach ( function ( tracenum ) {
5858 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 ;
6161 } ) ;
6262} ;
6363
6464// get counteraxis letter for this axis (name or id)
6565// this can also be used as the id for default counter axis
6666axes . 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' ;
6870} ;
6971
7072// incorporate a new minimum difference and first tick into
@@ -343,8 +345,8 @@ axes.autoBin = function(data,ax,nbins,is2d) {
343345 datamax = Plotly . Lib . aggNums ( Math . max , null , data ) ;
344346 if ( ax . type === 'category' ) {
345347 return {
346- start : datamin - 0.5 ,
347- end : datamax + 0.5 ,
348+ start : datamin - 0.5 ,
349+ end : datamax + 0.5 ,
348350 size : 1
349351 } ;
350352 }
@@ -457,12 +459,12 @@ axes.calcTicks = function calcTicks(ax) {
457459 var nt = ax . nticks ,
458460 minPx ;
459461 if ( ! nt ) {
460- if ( ax . type === 'category' ) {
462+ if ( ax . type === 'category' ) {
461463 minPx = ax . tickfont ? ( ax . tickfont . size || 12 ) * 1.2 : 15 ;
462464 nt = ax . _length / minPx ;
463465 }
464466 else {
465- minPx = ax . _id . charAt ( 0 ) === 'y' ? 40 : 80 ;
467+ minPx = ax . _id . charAt ( 0 ) === 'y' ? 40 : 80 ;
466468 nt = Plotly . Lib . constrain ( ax . _length / minPx , 4 , 9 ) + 1 ;
467469 }
468470 }
@@ -1417,7 +1419,7 @@ axes.doTicks = function(td, axid, skipTitle) {
14171419 var valsClipped = vals . filter ( clipEnds ) ;
14181420
14191421 function drawTicks ( container , tickpath ) {
1420- var ticks = container . selectAll ( 'path.' + tcls )
1422+ var ticks = container . selectAll ( 'path.' + tcls )
14211423 . data ( ax . ticks === 'inside' ? valsClipped : vals , datafn ) ;
14221424 if ( tickpath && ax . ticks ) {
14231425 ticks . enter ( ) . append ( 'path' ) . classed ( tcls , 1 ) . classed ( 'ticks' , 1 )
@@ -1431,7 +1433,7 @@ axes.doTicks = function(td, axid, skipTitle) {
14311433 else ticks . remove ( ) ;
14321434 }
14331435
1434- function drawLabels ( container , position ) {
1436+ function drawLabels ( container , position ) {
14351437 // tick labels - for now just the main labels.
14361438 // TODO: mirror labels, esp for subplots
14371439 var tickLabels = container . selectAll ( 'g.' + tcls ) . data ( vals , datafn ) ;
0 commit comments