Fix stale zmin/zmax used for autocontour levels after Plotly.react when contours.coloring is 'none' by capy-zhiao · Pull Request #8122 · plotly/plotly.js · GitHub
Skip to content
Open
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/8122_fix.md
8 changes: 6 additions & 2 deletions src/traces/contour/set_contours.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,14 @@ module.exports = function setContours(trace, vals) {
// these values here are meant to remain "per-trace" for now
var zmin = trace.zmin;
var zmax = trace.zmax;
if(trace.zauto || zmin === undefined) {
// `zauto` is only coerced when the trace has a colorscale (i.e. not for
// `contours.coloring: 'none'`). Treat an undefined `zauto` as auto, like
// Colorscale.calc does, so that we never reuse the zmin/zmax relinked
// from a previous full trace after `Plotly.react` (see #8117).
if(trace.zauto !== false || zmin === undefined) {
zmin = Lib.aggNums(Math.min, null, vals);
}
if(trace.zauto || zmax === undefined) {
if(trace.zauto !== false || zmax === undefined) {
zmax = Lib.aggNums(Math.max, null, vals);
}

Expand Down
29 changes: 29 additions & 0 deletions test/jasmine/tests/contour_test.js