@@ -682,10 +682,13 @@ axes.prepTicks = function(ax, opts) {
682
682
if ( ax . _name === 'radialaxis' ) nt *= 2 ;
683
683
}
684
684
685
- if ( ! ( ax . minor && ax . minor . tickmode !== 'array' ) ) {
685
+ if ( ! ( ax . minor &&
686
+ ( ax . minor . tickmode !== 'array' &&
687
+ ax . minor . tickmode !== 'domain array' &&
688
+ ax . minor . tickmode !== 'full domain' ) ) ) {
686
689
// add a couple of extra digits for filling in ticks when we
687
690
// have explicit tickvals without tick text
688
- if ( ax . tickmode === 'array' ) nt *= 100 ;
691
+ if ( ax . tickmode === 'array' || ax . tickmode === 'domain array' || ax . tickmode === 'full domain' ) nt *= 100 ;
689
692
}
690
693
691
694
ax . _roughDTick = Math . abs ( rng [ 1 ] - rng [ 0 ] ) / nt ;
@@ -920,7 +923,12 @@ axes.calcTicks = function calcTicks(ax, opts) {
920
923
var minorTicks = [ ] ;
921
924
922
925
var tickVals = [ ] ;
926
+ var tickFractionalVals = [ ] ;
927
+ tickFractionalVals . _isSet = false ;
928
+
923
929
var minorTickVals = [ ] ;
930
+ var minorTickFractionalVals = [ ] ;
931
+ minorTickFractionalVals . _isSet = false ;
924
932
925
933
var hasMinor = ax . minor && ( ax . minor . ticks || ax . minor . showgrid ) ;
926
934
@@ -944,9 +952,61 @@ axes.calcTicks = function calcTicks(ax, opts) {
944
952
axes . prepTicks ( mockAx , opts ) ;
945
953
}
946
954
955
+ if ( mockAx . tickmode === 'full domain' ) {
956
+ var nt = mockAx . nticks ; // does mockAx have nitkcs?
957
+ if ( nt === undefined ) nt = 0 ;
958
+ if ( nt === 0 ) {
959
+ // pass
960
+ } else if ( nt === 1 ) {
961
+ tickVals = [ 0 ] ;
962
+ } else if ( nt === 2 ) {
963
+ tickVals = [ 0 , 1 ] ;
964
+ } else {
965
+ var increment = 1 / ( nt - 1 ) ; // (nt-2) + 1
966
+ tickVals . push ( 0 ) ;
967
+ for ( var tickIndex = 0 ; tickIndex < nt - 2 ; tickIndex ++ ) {
968
+ tickVals . push ( ( tickIndex + 1 ) * increment ) ;
969
+ }
970
+ tickVals . push ( 1 ) ;
971
+ }
972
+ if ( major ) {
973
+ Lib . nestedProperty ( ax , 'tickvals' ) . set ( tickVals ) ;
974
+ } else {
975
+ Lib . nestedProperty ( ax . minor , 'tickvals' ) . set ( tickVals ) ;
976
+ }
977
+ }
978
+ // tickmode 'domain array' is just 'array' but with a pre-calc step
979
+ // original comment:
947
980
// now that we've figured out the auto values for formatting
948
981
// in case we're missing some ticktext, we can break out for array ticks
949
- if ( mockAx . tickmode === 'array' ) {
982
+ if ( mockAx . tickmode === 'array' || mockAx . tickmode === 'domain array' || mockAx . tickmode === 'full domain' ) {
983
+ // Mapping proportions to array:
984
+ if ( mockAx . tickmode === 'domain array' || mockAx . tickmode === 'full domain' ) {
985
+ var width = ( maxRange - minRange ) ;
986
+ if ( axrev ) width *= - 1 ;
987
+ var offset = ! axrev ? minRange : maxRange ;
988
+
989
+ var currentFractionalVals = [ ] ;
990
+ var currentValsProp ;
991
+ if ( major ) {
992
+ currentValsProp = Lib . nestedProperty ( ax , 'tickvals' ) ; // Do we need this?
993
+ currentFractionalVals = tickFractionalVals = currentValsProp . get ( ) ;
994
+ tickFractionalVals . _isSet = true ;
995
+ } else {
996
+ currentValsProp = Lib . nestedProperty ( ax . minor , 'tickvals' ) ;
997
+ currentFractionalVals = minorTickFractionalVals = currentValsProp . get ( ) ;
998
+ minorTickFractionalVals . _isSet = true ;
999
+ }
1000
+
1001
+ var mappedVals = Lib . simpleMap ( currentFractionalVals ,
1002
+ function ( fraction , offset , width , type ) {
1003
+ var mapped = offset + ( width * fraction ) ;
1004
+ return ( type === 'log' ) ? Math . pow ( 10 , mapped ) : mapped ;
1005
+ } , offset , width , type ) ;
1006
+ currentValsProp . set ( mappedVals ) ;
1007
+ }
1008
+
1009
+ // Original 'array' only code
950
1010
if ( major ) {
951
1011
tickVals = [ ] ;
952
1012
ticksOut = arrayTicks ( ax , ! isMinor ) ;
@@ -1204,6 +1264,7 @@ axes.calcTicks = function calcTicks(ax, opts) {
1204
1264
ticksOut . push ( t ) ;
1205
1265
}
1206
1266
}
1267
+
1207
1268
ticksOut = ticksOut . concat ( minorTicks ) ;
1208
1269
1209
1270
ax . _inCalcTicks = false ;
@@ -1213,6 +1274,18 @@ axes.calcTicks = function calcTicks(ax, opts) {
1213
1274
ticksOut [ 0 ] . noTick = true ;
1214
1275
}
1215
1276
1277
+ // Reset tickvals back to domain array
1278
+ if ( tickFractionalVals . _isSet ) {
1279
+ delete tickFractionalVals . _isSet ;
1280
+ if ( ax . tickmode === 'full domain' ) tickFractionalVals = [ ] ;
1281
+ Lib . nestedProperty ( ax , 'tickvals' ) . set ( tickFractionalVals ) ;
1282
+ }
1283
+ if ( minorTickFractionalVals . _isSet ) {
1284
+ delete tickFractionalVals . _isSet ;
1285
+ if ( ax . minor . tickmode === 'full domain' ) tickFractionalVals = [ ] ;
1286
+ Lib . nestedProperty ( ax . minor , 'tickvals' ) . set ( minorTickFractionalVals ) ;
1287
+ }
1288
+
1216
1289
return ticksOut ;
1217
1290
} ;
1218
1291
@@ -1617,7 +1690,7 @@ axes.tickFirst = function(ax, opts) {
1617
1690
// more precision for hovertext
1618
1691
axes . tickText = function ( ax , x , hover , noSuffixPrefix ) {
1619
1692
var out = tickTextObj ( ax , x ) ;
1620
- var arrayMode = ax . tickmode === 'array' ;
1693
+ var arrayMode = ( ax . tickmode === 'array' || ax . tickmode === 'domain array' || ax . tickmode === 'full domain' ) ;
1621
1694
var extraPrecision = hover || arrayMode ;
1622
1695
var axType = ax . type ;
1623
1696
// TODO multicategory, if we allow ticktext / tickvals
@@ -3333,7 +3406,7 @@ axes.drawGrid = function(gd, ax, opts) {
3333
3406
3334
3407
var counterAx = opts . counterAxis ;
3335
3408
if ( counterAx && axes . shouldShowZeroLine ( gd , ax , counterAx ) ) {
3336
- var isArrayMode = ax . tickmode === 'array' ;
3409
+ var isArrayMode = ( ax . tickmode === 'array' || ax . tickmode === 'domain array' || ax . tickmode === 'full domain' ) ;
3337
3410
for ( var i = 0 ; i < majorVals . length ; i ++ ) {
3338
3411
var xi = majorVals [ i ] . x ;
3339
3412
if ( isArrayMode ? ! xi : ( Math . abs ( xi ) < ax . dtick / 100 ) ) {
0 commit comments