-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fix contour plot colorscale domain #6625
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
Changes from 5 commits
66e7b3c
fb7e181
ae34826
29bf5db
e889dd1
27d84f1
736242c
fa5c3e3
bda830b
807504e
9f730ea
aea023c
1bd6571
af9a1d3
aea78dd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
- Fix contour plot colorscale domain (take account of [zmin, zmax] and [cmin, cmax]) [[#6625](https://github.com/plotly/plotly.js/pull/6625)] | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -512,7 +512,7 @@ function drawColorBar(g, opts, gd) { | |
.data(fillLevels); | ||
fills.enter().append('rect') | ||
.classed(cn.cbfill, true) | ||
.style('stroke', 'none'); | ||
.attr('style', ''); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you please explain this change? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, it's a bit tricky to explain.. The first thing to note is that when calling Now, we have (before this commit) : var fills = g.select('.' + cn.cbfills)
.selectAll('rect.' + cn.cbfill)
.attr('style', '') // -> existing <rect> have empty `style` attribute
.data(fillLevels);
fills.enter().append('rect')
.classed(cn.cbfill, true)
.style('stroke', 'none'); // -> missing <rect> are added with `style='stroke: none;'`
fills.exit().remove(); So, if I'm not wrong :
This discrepancy causes this test case to fail, because some attributes are changing between transition/redraw. So this commit is just to fix that. Now the question is : how the heck this test case hasn't ever failed until this PR ? I think this could have to do with the double call and possible race conditions.. Hopefully I've been able to reproduce the failure without the colorbar fix, by using a mock with more data than those used previously by the test (longer to draw, hence the suspicion about race conditions), also fixed the promise chaining. I'm going to commit that so you can double check all of this. |
||
fills.exit().remove(); | ||
|
||
var zBounds = zrange | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,8 +45,8 @@ | |
"end": 10, | ||
"size": 1 | ||
}, | ||
"zmin": 0, | ||
"zmax": 20 | ||
"zmin": 2, | ||
"zmax": 10 | ||
} | ||
], | ||
"layout": { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -655,6 +655,8 @@ | |
} | ||
], | ||
"coloraxis": { | ||
"cmin": 0, | ||
"cmax": 8.5, | ||
"colorscale": [ | ||
[ | ||
0, | ||
|
Uh oh!
There was an error while loading. Please reload this page.