Skip to content
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

Bugfix: categorical axis tickson boundaries showgrid #6885

Merged
merged 7 commits into from
Feb 8, 2024
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
1 change: 1 addition & 0 deletions draftlogs/6885_change.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Fix bug where plots with axis `type='categorical'`, `tickson = "boundaries"` and `showgrid=true` wouldn't load, see [plotly.py # 3155](https://github.com/plotly/plotly.py/issues/3155). This feature was anonymously sponsored: thank you to our sponsor!
4 changes: 2 additions & 2 deletions src/plots/cartesian/axes.js
Original file line number Diff line number Diff line change
Expand Up @@ -2807,7 +2807,7 @@ function getBoundaryVals(ax, vals) {
// boundaryVals are never used for labels;
// no need to worry about the other tickTextObj keys
var _push = function(d, bndIndex) {
var xb = d.xbnd[bndIndex];
var xb = d.xbnd ? d.xbnd[bndIndex] : d.x;
if(xb !== null) {
out.push(Lib.extendFlat({}, d, {x: xb}));
}
Expand Down Expand Up @@ -3755,7 +3755,7 @@ axes.drawLabels = function(gd, ax, opts) {
// TODO should secondary labels also fall into this fix-overlap regime?

for(i = 0; i < lbbArray.length; i++) {
var xbnd = vals[i].xbnd;
var xbnd = (vals && vals[i].xbnd) ? vals[i].xbnd : [null, null];
var lbb = lbbArray[i];
if(
(xbnd[0] !== null && (lbb.left - ax.l2p(xbnd[0])) < gap) ||
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions test/image/mocks/zz-tickson_boundaries_showgrid_categorical.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"data": [
{
"type": "bar",
"y": [1, 2, 3, 4, 5],
"x": ["a", "b", "c", "d", "e"]
}
],
"layout": {
"width": 600,
"height": 300,
"xaxis": {
"tickmode": "array",
"tickvals": [0,2,4],
"ticktext": ["One", "Three", "Five"],
"tickson": "boundaries",
"showgrid": true
}
}
}