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

Fix range defaults to take into account minallowed and maxallowed values #6796

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 5 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
fix 6765 - ensure default range work with allowed min/max
  • Loading branch information
archmoj committed Nov 23, 2023
commit d8ff2d53fffa794355d414f5901dee68ab0caad1
5 changes: 5 additions & 0 deletions 5 src/plots/cartesian/set_convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,11 @@ module.exports = function setConvert(ax, fullLayout) {

if(minallowed !== undefined && rng[0] < bounds[0]) range[axrev ? 1 : 0] = minallowed;
if(maxallowed !== undefined && rng[1] > bounds[1]) range[axrev ? 0 : 1] = maxallowed;

if(range[0] === range[1]) {
if(minallowed !== undefined) range[axrev ? 1 : 0] = ax.l2r(minallowed + 1);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if maxallowed-minallowed<1?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call.
Addressed in aadbd54

if(maxallowed !== undefined) range[axrev ? 0 : 1] = ax.l2r(maxallowed - 1);
}
};

/*
Expand Down
18 changes: 18 additions & 0 deletions 18 src/plots/polar/polar.js
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,24 @@ proto.doAutoRange = function(fullLayout, polarLayout) {
radialAxis.r2l(rng[0], null, 'gregorian'),
radialAxis.r2l(rng[1], null, 'gregorian')
];

var minallowed = radialAxis.minallowed;
if(minallowed !== undefined) {
if(radialAxis._rl[0] > radialAxis._rl[1]) {
radialAxis._rl[1] = Math.max(radialAxis._rl[1], minallowed);
} else {
radialAxis._rl[0] = Math.max(radialAxis._rl[0], minallowed);
}
}

var maxallowed = radialAxis.maxallowed;
if(maxallowed !== undefined) {
if(radialAxis._rl[0] < radialAxis._rl[1]) {
radialAxis._rl[1] = Math.min(radialAxis._rl[1], maxallowed);
} else {
radialAxis._rl[0] = Math.min(radialAxis._rl[0], maxallowed);
}
}
};

proto.updateRadialAxis = function(fullLayout, polarLayout) {
Expand Down
Binary file added BIN +90.2 KB test/image/baselines/zz-allowed-range.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
79 changes: 79 additions & 0 deletions 79 test/image/mocks/zz-allowed-range.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"data": [
{
"type": "scatter",
"mode": "markers",
"xaxis": "x",
"yaxis": "y",
"x": [0,1,2,3,4,5,6,7,8,9,10],
"y":[0,10,20,30,40,50,60,70,80,90,100]
},
{
"type": "scatter",
"mode": "markers",
"xaxis": "x2",
"yaxis": "y2",
"x": [0,1,2,3,4,5,6,7,8,9,10],
"y":[0,10,20,30,40,50,60,70,80,90,100]
},
{
"type": "scatterpolar",
"mode": "markers",
"subplot": "polar",
"r": [0,1,2,3,4,5,6,7,8,9,10],
"theta":[0,10,20,30,40,50,60,70,80,90,100]
},
{
"type": "scatterpolar",
"mode": "markers",
"subplot": "polar2",
"r": [0,1,2,3,4,5,6,7,8,9,10],
"theta":[0,10,20,30,40,50,60,70,80,90,100]
}
],
"layout": {
"showlegend": false,
"width": 800,
"height": 800,
"xaxis": {
"anchor": "y",
"domain": [0, 0.45],
"minallowed": 6
},
"yaxis": {
"anchor": "x",
"domain": [0, 0.45],
"minallowed": 6
},
"xaxis2": {
"autorange": "reversed",
"anchor": "y2",
"domain": [0, 0.45],
"minallowed": 6
},
"yaxis2": {
"anchor": "x2",
"domain": [0.55, 1],
"minallowed": 6
},
"polar": {
"domain": {
"x": [0.55, 1],
"y": [0, 0.45]
},
"radialaxis": {
"minallowed": 6
}
},
"polar2": {
"domain": {
"x": [0.55, 1],
"y": [0.55, 1]
},
"radialaxis": {
"autorange": "reversed",
"minallowed": 6
}
}
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.