@@ -679,11 +679,11 @@ axes.calcTicks = function calcTicks(ax) {
679
679
// show the exponent only on the last one
680
680
ax . _tmax = vals [ vals . length - 1 ] ;
681
681
682
- // for showing date suffixes: ax._prevSuffix holds what we showed most
683
- // recently. Start with it cleared and mark that we're in calcTicks (ie
684
- // calculating a whole string of these so we should care what the previous
685
- // suffix was!)
686
- ax . _prevSuffix = '' ;
682
+ // for showing the rest of a date when the main tick label is only the
683
+ // latter part: ax._prevDateHead holds what we showed most recently.
684
+ // Start with it cleared and mark that we're in calcTicks (ie calculating a
685
+ // whole string of these so we should care what the previous date head was!)
686
+ ax . _prevDateHead = '' ;
687
687
ax . _inCalcTicks = true ;
688
688
689
689
var ticksOut = new Array ( vals . length ) ;
@@ -1107,10 +1107,10 @@ function formatDate(ax, out, hover, extraPrecision) {
1107
1107
var x = out . x ,
1108
1108
tr = ax . _tickround ,
1109
1109
d = new Date ( x ) ,
1110
- // suffix completes the full date info, to be included
1110
+ // headPart completes the full date info, to be included
1111
1111
// with only the first tick or if any info before what's
1112
1112
// shown has changed
1113
- suffix ,
1113
+ headPart ,
1114
1114
tt ;
1115
1115
if ( hover && ax . hoverformat ) {
1116
1116
tt = modDateFormat ( ax . hoverformat , x ) ;
@@ -1129,12 +1129,12 @@ function formatDate(ax, out, hover, extraPrecision) {
1129
1129
else if ( tr === 'm' ) tt = monthFormat ( d ) ;
1130
1130
else {
1131
1131
if ( tr === 'd' ) {
1132
- suffix = yearFormat ( d ) ;
1132
+ headPart = yearFormat ( d ) ;
1133
1133
1134
1134
tt = dayFormat ( d ) ;
1135
1135
}
1136
1136
else {
1137
- suffix = yearMonthDayFormat ( d ) ;
1137
+ headPart = yearMonthDayFormat ( d ) ;
1138
1138
1139
1139
tt = minuteFormat ( d ) ;
1140
1140
if ( tr !== 'M' ) {
@@ -1151,8 +1151,8 @@ function formatDate(ax, out, hover, extraPrecision) {
1151
1151
// we get extra precision in array mode or hover,
1152
1152
// but it may be useless, strip it off
1153
1153
if ( tt === '00:00:00' || tt === '00:00' ) {
1154
- tt = suffix ;
1155
- suffix = '' ;
1154
+ tt = headPart ;
1155
+ headPart = '' ;
1156
1156
}
1157
1157
else if ( tt . length === 8 ) {
1158
1158
// strip off seconds if they're zero (zero fractional seconds
@@ -1161,16 +1161,16 @@ function formatDate(ax, out, hover, extraPrecision) {
1161
1161
}
1162
1162
}
1163
1163
1164
- if ( suffix ) {
1164
+ if ( headPart ) {
1165
1165
if ( hover ) {
1166
- // hover puts it all on one line, so suffix works best up front
1167
- // except for year suffix : turn this into "Jan 1, 2000" etc.
1168
- if ( tr === 'd' ) tt += ', ' + suffix ;
1169
- else tt = suffix + ( tt ? ', ' + tt : '' ) ;
1170
- }
1171
- else if ( ! ax . _inCalcTicks || ( suffix !== ax . _prevSuffix ) ) {
1172
- tt += '<br>' + suffix ;
1173
- ax . _prevSuffix = suffix ;
1166
+ // hover puts it all on one line, so headPart works best up front
1167
+ // except for year headPart : turn this into "Jan 1, 2000" etc.
1168
+ if ( tr === 'd' ) tt += ', ' + headPart ;
1169
+ else tt = headPart + ( tt ? ', ' + tt : '' ) ;
1170
+ }
1171
+ else if ( ! ax . _inCalcTicks || ( headPart !== ax . _prevDateHead ) ) {
1172
+ tt += '<br>' + headPart ;
1173
+ ax . _prevDateHead = headPart ;
1174
1174
}
1175
1175
}
1176
1176
out . text = tt ;
0 commit comments