Skip to content

Do not display first tick added by period ticklabelmode #5055

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/plots/cartesian/axes.js
Original file line number Diff line number Diff line change
Expand Up @@ -2440,8 +2440,17 @@ axes.drawTicks = function(gd, ax, opts) {

var cls = ax._id + 'tick';

var vals = opts.vals;
if(
ax.ticklabelmode === 'period'
) {
// drop very first tick that we added to handle period
vals = vals.slice();
vals.shift();
}

var ticks = opts.layer.selectAll('path.' + cls)
.data(ax.ticks ? opts.vals : [], tickDataFn);
.data(ax.ticks ? vals : [], tickDataFn);

ticks.exit().remove();

Expand Down
Binary file modified test/image/baselines/date_axes_period2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions test/image/mocks/date_axes_period2.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@
]
},
"xaxis": {
"tickcolor": "black",
"gridcolor": "orange",
"range": [
"2019-12-24",
"2020-01-06"
Expand All @@ -138,6 +140,8 @@
"tickformat": "%b %d, %Y"
},
"xaxis2": {
"tickcolor": "black",
"gridcolor": "orange",
"range": [
"2019-12-29",
"2020-01-04"
Expand All @@ -146,6 +150,8 @@
"anchor": "y2"
},
"xaxis3": {
"tickcolor": "black",
"gridcolor": "orange",
"range": [
"2020-01-03",
"2019-12-28"
Expand All @@ -154,6 +160,8 @@
"anchor": "y3"
},
"xaxis4": {
"tickcolor": "black",
"gridcolor": "orange",
"range": [
"2020-03-01",
"2020-11-01"
Expand All @@ -162,6 +170,8 @@
"anchor": "y4"
},
"xaxis5": {
"tickcolor": "black",
"gridcolor": "orange",
"range": [
"2016-09-01",
"2017-06-01"
Expand All @@ -170,6 +180,8 @@
"anchor": "y5"
},
"xaxis6": {
"tickcolor": "black",
"gridcolor": "orange",
"range": [
"2016-05-01",
"2019-09-01"
Expand All @@ -178,6 +190,8 @@
"anchor": "y6"
},
"xaxis7": {
"tickcolor": "black",
"gridcolor": "orange",
"range": [
"2016-05-01",
"2021-09-01"
Expand Down