Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Setting layout.xaxis.tickmode to 'array' explicitly does not work on date and log axes #4302

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

Closed
ark-ark opened this issue Oct 25, 2019 · 4 comments
Labels
bug something broken
Milestone

Comments

@ark-ark
Copy link

ark-ark commented Oct 25, 2019

Setting layout.xaxis.tickmode to array explicitly does not work at all. If set to array all settings regarding tickvals and ticktext will be ignored. tickvals and ticktext only have an effect if tickmode is not set.

See https://jsfiddle.net/xt6udrkh/2/

@etpinard
Copy link
Contributor

Thanks for reporting.

The current logic is pretty clear:

if(containerIn.tickmode === 'array' &&
(axType === 'log' || axType === 'date')) {
tickmode = containerOut.tickmode = 'auto';
} else {
var tickmodeDefault = Array.isArray(containerIn.tickvals) ? 'array' :
containerIn.dtick ? 'linear' :
'auto';
tickmode = coerce('tickmode', tickmodeDefault);
}

I'm not sure why tickmode is set to 'auto' here. Maybe tickvals / ticktext used to not work on date and log axes.

@etpinard etpinard changed the title Setting layout.xaxis.tickmode to 'array' explicitly does not work Setting layout.xaxis.tickmode to 'array' explicitly does not work on date and log axes Oct 25, 2019
@etpinard etpinard added the bug something broken label Oct 25, 2019
@etpinard
Copy link
Contributor

Commit 355fb09 changed a few things and may be the culprit.

@etpinard
Copy link
Contributor

etpinard commented Oct 25, 2019

and then there's this test:

axIn = {tickmode: 'array', tickvals: [1, 2, 3]};
axOut = {};
mockSupplyDefaults(axIn, axOut, 'date');
expect(axOut.tickmode).toBe('auto');
expect(axIn.tickmode).toBe('array');

clearly 🔒 ing down the reported behavior 🤔

@archmoj archmoj added this to the v1.54.2 milestone Jun 8, 2020
@archmoj
Copy link
Contributor

archmoj commented Jun 8, 2020

Fixed via #4851.

@archmoj archmoj closed this as completed Jun 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken
Projects
None yet
Development

No branches or pull requests

3 participants