@@ -702,9 +702,10 @@ axes.calcTicks = function calcTicks(ax, opts) {
702
702
var maxRange = Math . max ( rng [ 0 ] , rng [ 1 ] ) ;
703
703
704
704
var definedDelta ;
705
- if ( isPeriod && ax . tickformat ) {
705
+ var tickformat = axes . getTickFormat ( ax ) ; // don't use ax.tickformat directly
706
+ if ( isPeriod ) {
706
707
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 ) )
708
709
// %f: microseconds as a decimal number [000000, 999999]
709
710
// %L: milliseconds as a decimal number [000, 999]
710
711
// %Q: milliseconds since UNIX epoch
@@ -717,7 +718,7 @@ axes.calcTicks = function calcTicks(ax, opts) {
717
718
// %X: the locale’s time, such as %-I:%M:%S %p
718
719
) {
719
720
if (
720
- / % [ A a d e j u w x ] / . test ( ax . tickformat )
721
+ / % [ A a d e j u w x ] / . test ( tickformat )
721
722
// %A: full weekday name
722
723
// %a: abbreviated weekday name
723
724
// %d: zero-padded day of the month as a decimal number [01,31]
@@ -728,23 +729,23 @@ axes.calcTicks = function calcTicks(ax, opts) {
728
729
// %x: the locale’s date, such as %-m/%-d/%Y
729
730
) definedDelta = ONEDAY ;
730
731
else if (
731
- / % [ U V W ] / . test ( ax . tickformat )
732
+ / % [ U V W ] / . test ( tickformat )
732
733
// %U: Sunday-based week of the year as a decimal number [00,53]
733
734
// %V: ISO 8601 week of the year as a decimal number [01, 53]
734
735
// %W: Monday-based week of the year as a decimal number [00,53]
735
736
) definedDelta = ONEWEEK ;
736
737
else if (
737
- / % [ B b m ] / . test ( ax . tickformat )
738
+ / % [ B b m ] / . test ( tickformat )
738
739
// %B: full month name
739
740
// %b: abbreviated month name
740
741
// %m: month as a decimal number [01,12]
741
742
) definedDelta = ONEAVGMONTH ;
742
743
else if (
743
- / % [ q ] / . test ( ax . tickformat )
744
+ / % [ q ] / . test ( tickformat )
744
745
// %q: quarter of the year as a decimal number [1,4]
745
746
) definedDelta = ONEAVGQUARTER ;
746
747
else if (
747
- / % [ Y y ] / . test ( ax . tickformat )
748
+ / % [ Y y ] / . test ( tickformat )
748
749
// %Y: year with century as a decimal number, such as 1999
749
750
// %y: year without century as a decimal number [00,99]
750
751
) definedDelta = ONEAVGYEAR ;
@@ -945,7 +946,7 @@ axes.autoTicks = function(ax, roughDTick) {
945
946
// 2 or 3 days... but that's a weird enough case that we'll ignore it.
946
947
ax . tick0 = Lib . dateTick0 ( ax . calendar , true ) ;
947
948
948
- if ( / % [ u V W ] / . test ( ax . tickformat ) ) {
949
+ if ( / % [ u V W ] / . test ( ax . tickformat ) ) { // should we use axes.getTickFormat(ax) instead here?
949
950
// replace Sunday with Monday for ISO and Monday-based formats
950
951
var len = ax . tick0 . length ;
951
952
var lastD = + ax . tick0 [ len - 1 ] ;
0 commit comments