@@ -702,9 +702,10 @@ axes.calcTicks = function calcTicks(ax, opts) {
702702 var maxRange = Math . max ( rng [ 0 ] , rng [ 1 ] ) ;
703703
704704 var definedDelta ;
705- if ( isPeriod && ax . tickformat ) {
705+ var tickformat = axes . getTickFormat ( ax ) ; // don't use ax.tickformat directly
706+ if ( isPeriod ) {
706707 if (
707- ! ( / % [ f L Q s S M H I p X ] / . test ( ax . tickformat ) )
708+ ! ( / % [ f L Q s S M H I p X ] / . test ( tickformat ) )
708709 // %f: microseconds as a decimal number [000000, 999999]
709710 // %L: milliseconds as a decimal number [000, 999]
710711 // %Q: milliseconds since UNIX epoch
@@ -717,7 +718,7 @@ axes.calcTicks = function calcTicks(ax, opts) {
717718 // %X: the locale’s time, such as %-I:%M:%S %p
718719 ) {
719720 if (
720- / % [ A a d e j u w x ] / . test ( ax . tickformat )
721+ / % [ A a d e j u w x ] / . test ( tickformat )
721722 // %A: full weekday name
722723 // %a: abbreviated weekday name
723724 // %d: zero-padded day of the month as a decimal number [01,31]
@@ -728,23 +729,23 @@ axes.calcTicks = function calcTicks(ax, opts) {
728729 // %x: the locale’s date, such as %-m/%-d/%Y
729730 ) definedDelta = ONEDAY ;
730731 else if (
731- / % [ U V W ] / . test ( ax . tickformat )
732+ / % [ U V W ] / . test ( tickformat )
732733 // %U: Sunday-based week of the year as a decimal number [00,53]
733734 // %V: ISO 8601 week of the year as a decimal number [01, 53]
734735 // %W: Monday-based week of the year as a decimal number [00,53]
735736 ) definedDelta = ONEWEEK ;
736737 else if (
737- / % [ B b m ] / . test ( ax . tickformat )
738+ / % [ B b m ] / . test ( tickformat )
738739 // %B: full month name
739740 // %b: abbreviated month name
740741 // %m: month as a decimal number [01,12]
741742 ) definedDelta = ONEAVGMONTH ;
742743 else if (
743- / % [ q ] / . test ( ax . tickformat )
744+ / % [ q ] / . test ( tickformat )
744745 // %q: quarter of the year as a decimal number [1,4]
745746 ) definedDelta = ONEAVGQUARTER ;
746747 else if (
747- / % [ Y y ] / . test ( ax . tickformat )
748+ / % [ Y y ] / . test ( tickformat )
748749 // %Y: year with century as a decimal number, such as 1999
749750 // %y: year without century as a decimal number [00,99]
750751 ) definedDelta = ONEAVGYEAR ;
@@ -945,7 +946,7 @@ axes.autoTicks = function(ax, roughDTick) {
945946 // 2 or 3 days... but that's a weird enough case that we'll ignore it.
946947 ax . tick0 = Lib . dateTick0 ( ax . calendar , true ) ;
947948
948- if ( / % [ u V W ] / . test ( ax . tickformat ) ) {
949+ if ( / % [ u V W ] / . test ( ax . tickformat ) ) { // should we use axes.getTickFormat(ax) instead here?
949950 // replace Sunday with Monday for ISO and Monday-based formats
950951 var len = ax . tick0 . length ;
951952 var lastD = + ax . tick0 [ len - 1 ] ;
0 commit comments