-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
zeroline is not visible when axis has no gridlines #4027
Comments
Thanks for writing in! At present, we don't draw the The logic is here: plotly.js/src/plots/cartesian/axes.js Lines 2732 to 2745 in 323e79a
I can't remember exactly why the |
On second thoughts, I'm starting to think this report should be considered a bug (thanks @alexcjohnson ) Removing plotly.js/src/plots/cartesian/axes.js Line 2738 in 323e79a
does not make any of our tests fail. The only problem I see is: as some axes
a "new" zeroline will appear on some graphs. Now I agree that: xaxis: {
zeroline: true,
nticks: 1
} should show the zeroline, even when it's on one of the plot area edges. Would anyone be opposed to adding a axes.shouldShowZeroLine = function(gd, ax, counterAxis) {
var rng = Lib.simpleMap(ax.range, ax.r2l);
return (
(rng[0] * rng[1] <= 0) &&
ax.zeroline &&
(ax.type === 'linear' || ax.type === '-') &&
(ax._gridVals.length || ax._input.zeroline) &&
(
clipEnds(ax, 0) ||
!anyCounterAxLineAtZero(gd, ax, counterAxis, rng) ||
hasBarsOrFill(gd, ax)
)
);
}; |
My gut reaction is if |
I'm going to slip in a fix for this bug i.e. by simply removing plotly.js/src/plots/cartesian/axes.js Line 2738 in 323e79a
in 1.50.0. |
- see #4027 for complete rationale - add assertZeroLines assertion
https://codepen.io/anon/pen/pXxqeW
zeroline is not visible if these conditions are met:
If you change nticks to: 0 | 3 | 3+ it is shown again.
Unfortunately I need to hide all the ticks except tick0 as this configuration will be used for subplots.
The solution with mirror axis works better, but:
https://codepen.io/anon/pen/OeBGjN
The text was updated successfully, but these errors were encountered: