Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1b55b42

Browse filesBrowse files
committed
fix 'increase dtick' lgoic for cases with dtick value starting 'M'
1 parent 40d57fa commit 1b55b42
Copy full SHA for 1b55b42

File tree

Expand file treeCollapse file tree

3 files changed

+7
-4
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+7
-4
lines changed

‎src/plots/cartesian/axes.js

Copy file name to clipboardExpand all lines: src/plots/cartesian/axes.js
+5-2Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,9 @@ axes.prepTicks = function(ax) {
526526
// have explicit tickvals without tick text
527527
if(ax.tickmode === 'array') nt *= 100;
528528

529-
axes.autoTicks(ax, (Math.abs(rng[1] - rng[0]) - (ax._lBreaks || 0)) / nt);
529+
530+
ax._roughDTick = (Math.abs(rng[1] - rng[0]) - (ax._lBreaks || 0)) / nt;
531+
axes.autoTicks(ax, ax._roughDTick);
530532

531533
// check for a forced minimum dtick
532534
if(ax._minDtick > 0 && ax.dtick < ax._minDtick * 2) {
@@ -620,7 +622,8 @@ axes.calcTicks = function calcTicks(ax) {
620622
// increase dtick to generate more ticks,
621623
// so that some hopefully fall between breaks
622624
if(ax.tickmode === 'auto' && tickVals.length < nTicksBefore / 6) {
623-
ax.dtick /= 2;
625+
axes.autoTicks(ax, ax._roughDTick / 3);
626+
autoTickRound(ax);
624627
ax._tmin = axes.tickFirst(ax);
625628
generateTicks();
626629
tickVals = tickVals.filter(function(d) {
147 Bytes
Loading

‎test/jasmine/tests/axes_test.js

Copy file name to clipboardExpand all lines: test/jasmine/tests/axes_test.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4880,8 +4880,8 @@ describe('Test axes', function() {
48804880
.then(function() {
48814881
_assert('with breaks enabled on x-axis', {
48824882
tickVals: [
4883-
1483531200000, 1484136000000, 1484740800000, 1485345600000,
4884-
1485950400000, 1486555200000, 1487160000000
4883+
1483574400000, 1484092800000, 1484611200000, 1484870400000,
4884+
1485388800000, 1485907200000, 1486425600000, 1486684800000
48854885
]
48864886
});
48874887
})

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.