diff --git a/src/plots/cartesian/axes.js b/src/plots/cartesian/axes.js
index 865128da9b1..f3edcac3d3e 100644
--- a/src/plots/cartesian/axes.js
+++ b/src/plots/cartesian/axes.js
@@ -844,7 +844,11 @@ axes.calcTicks = function calcTicks(ax, opts) {
periodLength *= ratio;
} else {
// case of big gap
- periodLength = ratio * actualDelta;
+ if(actualDelta === ax.dtick) {
+ periodLength = ratio * actualDelta;
+ } else {
+ periodLength = ratio * (actualDelta + periodLength) / 2;
+ }
}
}
diff --git a/test/jasmine/tests/axes_test.js b/test/jasmine/tests/axes_test.js
index 10aa81c508b..5467f54de1f 100644
--- a/test/jasmine/tests/axes_test.js
+++ b/test/jasmine/tests/axes_test.js
@@ -5867,37 +5867,37 @@ describe('Test axes', function() {
[
{
range: ['2020-12-14 08:00', '2022-12-14 08:00'],
- positions: ['2020-12-17 02:47:08.5714', '2021-03-19 20:51:25.7143', '2021-06-17 16:17:08.5714', '2021-09-17 12:00', '2021-12-19 11:08:34.2857', '2022-03-17 16:17:08.5714', '2022-06-17 16:17:08.5714', '2022-09-18 14:00', '2022-12-18 14:00'],
- labels: ['Dec 2020', 'Mar 2021', 'Jun 2021', 'Sep 2021', 'Dec 2021', 'Mar 2022', 'Jun 2022', 'Sep 2022', '']
+ positions: ['2020-12-11 18:36:57.8571', '2021-03-13 15:20:53.5714', '2021-06-12 04:21:57.8571', '2021-09-12 02:13:23.5714', '2021-12-13 10:29:27.8571', '2022-03-12 04:21:57.8571', '2022-06-12 04:21:57.8571', '2022-09-12 19:34:17.1429', '2022-12-12 19:34:17.1429'],
+ labels: ['', 'Mar 2021', 'Jun 2021', 'Sep 2021', 'Dec 2021', 'Mar 2022', 'Jun 2022', 'Sep 2022', 'Dec 2022']
},
{
range: ['2020-12-14 08:00', '2021-08-14 08:00'],
- positions: ['2020-12-08 17:21:25.7143', '2020-12-27 22:00', '2021-01-24 22:00', '2021-02-21 22:00', '2021-03-21 22:00', '2021-04-18 22:00', '2021-05-16 22:00', '2021-06-13 22:00', '2021-07-11 22:00', '2021-08-08 22:00'],
+ positions: ['2020-12-07 10:49:17.1429', '2020-12-27 22:00', '2021-01-24 22:00', '2021-02-21 22:00', '2021-03-21 22:00', '2021-04-18 22:00', '2021-05-16 22:00', '2021-06-13 22:00', '2021-07-11 22:00', '2021-08-08 22:00'],
labels: ['', 'Dec 21
2020', 'Jan 18
2021', 'Feb 15', 'Mar 15', 'Apr 12', 'May 10', 'Jun 7', 'Jul 5', 'Aug 2']
},
{
range: ['2020-12-14 08:00', '2021-04-14 08:00'],
- positions: ['2020-12-14 06:38:34.2857', '2020-12-24 14:00', '2021-01-07 14:00', '2021-01-21 14:00', '2021-02-04 14:00', '2021-02-18 14:00', '2021-03-04 14:00', '2021-03-18 14:00', '2021-04-01 14:00', '2021-04-15 14:00'],
- labels: ['', 'Dec 21
2020', 'Jan 4
2021', 'Jan 18', 'Feb 1', 'Feb 15', 'Mar 1', 'Mar 15', 'Mar 29', '']
+ positions: ['2020-12-13 17:10:42.8571', '2020-12-23 00:51:25.7143', '2021-01-06 00:51:25.7143', '2021-01-20 00:51:25.7143', '2021-02-03 00:51:25.7143', '2021-02-17 00:51:25.7143', '2021-03-03 00:51:25.7143', '2021-03-17 00:51:25.7143', '2021-03-31 00:51:25.7143', '2021-04-14 00:51:25.7143'],
+ labels: ['', 'Dec 21
2020', 'Jan 4
2021', 'Jan 18', 'Feb 1', 'Feb 15', 'Mar 1', 'Mar 15', 'Mar 29', 'Apr 12']
},
{
range: ['2020-12-14 08:00', '2021-02-14 08:00'],
- positions: ['2020-12-14 06:38:34.2857', '2020-12-22 12:00', '2020-12-29 12:00', '2021-01-05 12:00', '2021-01-12 12:00', '2021-01-19 12:00', '2021-01-26 12:00', '2021-02-02 12:00', '2021-02-09 16:45:42.8571', '2021-02-15 18:45:42.8571'],
+ positions: ['2020-12-13 17:10:42.8571', '2020-12-22 12:00', '2020-12-29 12:00', '2021-01-05 12:00', '2021-01-12 12:00', '2021-01-19 12:00', '2021-01-26 12:00', '2021-02-02 12:00', '2021-02-09 02:14:17.1429', '2021-02-15 04:14:17.1429'],
labels: ['', 'Dec 21
2020', 'Dec 28', 'Jan 4
2021', 'Jan 11', 'Jan 18', 'Jan 25', 'Feb 1', 'Feb 8', '']
},
{
range: ['2020-12-14 08:00', '2021-01-14 08:00'],
- positions: ['2020-12-14 11:34:17.1429', '2020-12-16 12:17:08.5714', '2020-12-18 18:34:17.1429', '2020-12-22 12:17:08.5714', '2020-12-24 18:34:17.1429', '2020-12-28 12:17:08.5714', '2020-12-30 12:17:08.5714', '2021-01-01 18:34:17.1429', '2021-01-05 12:17:08.5714', '2021-01-07 18:34:17.1429', '2021-01-11 12:17:08.5714', '2021-01-13 12:17:08.5714'],
+ positions: ['2020-12-14 08:21:25.7143', '2020-12-16 12:17:08.5714', '2020-12-18 13:51:25.7143', '2020-12-22 12:17:08.5714', '2020-12-24 13:51:25.7143', '2020-12-28 12:17:08.5714', '2020-12-30 12:17:08.5714', '2021-01-01 13:51:25.7143', '2021-01-05 12:17:08.5714', '2021-01-07 13:51:25.7143', '2021-01-11 12:17:08.5714', '2021-01-13 12:17:08.5714'],
labels: ['Dec 14
2020', 'Dec 16', 'Dec 18', 'Dec 22', 'Dec 24', 'Dec 28', 'Dec 30', 'Jan 1
2021', 'Jan 5', 'Jan 7', 'Jan 11', 'Jan 13']
},
{
range: ['2020-12-14 08:00', '2021-01-01 08:00'],
- positions: ['2020-12-14 11:34:17.1429', '2020-12-16 12:17:08.5714', '2020-12-18 18:34:17.1429', '2020-12-22 12:17:08.5714', '2020-12-24 18:34:17.1429', '2020-12-28 12:17:08.5714', '2020-12-30 12:17:08.5714', '2021-01-01 12:17:08.5714'],
+ positions: ['2020-12-14 08:21:25.7143', '2020-12-16 12:17:08.5714', '2020-12-18 13:51:25.7143', '2020-12-22 12:17:08.5714', '2020-12-24 13:51:25.7143', '2020-12-28 12:17:08.5714', '2020-12-30 12:17:08.5714', '2021-01-01 12:17:08.5714'],
labels: ['Dec 14
2020', 'Dec 16', 'Dec 18', 'Dec 22', 'Dec 24', 'Dec 28', 'Dec 30', '']
},
{
range: ['2020-12-14 08:00', '2020-12-22 08:00'],
- positions: ['2020-12-14 06:04:17.1429', '2020-12-15 12:00', '2020-12-16 12:00', '2020-12-17 12:00', '2020-12-18 12:00', '2020-12-21 12:00', '2020-12-22 12:00'],
+ positions: ['2020-12-14 05:27:51.4286', '2020-12-15 12:00', '2020-12-16 12:00', '2020-12-17 12:00', '2020-12-18 10:00', '2020-12-21 12:00', '2020-12-22 12:00'],
labels: ['', '06:00
Dec 15, 2020', '06:00
Dec 16, 2020', '06:00
Dec 17, 2020', '06:00
Dec 18, 2020', '06:00
Dec 21, 2020', '']
},
{