Skip to content
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
9 changes: 9 additions & 0 deletions src/plots/plots.js
Original file line number Diff line number Diff line change
Expand Up @@ -2828,6 +2828,15 @@ plots.doCalcdata = function(gd, traces) {
);
}

// clear relinked cmin/cmax values in shared axes to start aggregation from scratch
for(var k in fullLayout._colorAxes) {
var cOpts = fullLayout[k];
if(cOpts.cauto !== false) {
delete cOpts.cmin;
delete cOpts.cmax;
}
}

var hasCalcTransform = false;

function transformCalci(i) {
Expand Down
36 changes: 36 additions & 0 deletions test/jasmine/tests/colorscale_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1101,6 +1101,42 @@ describe('Test colorscale restyle calls:', function() {
.then(done);
});

it('should update coloraxis cmin/cmax on color value changes', function(done) {
function fig(mc) {
return {
data: [{
mode: 'markers',
y: [1, 2, 3],
marker: {
coloraxis: 'coloraxis',
color: mc
}
}]
};
}

function _assert(msg, cmin, cmax) {
return function() {
var cOpts = gd._fullLayout.coloraxis;
expect(cOpts.cmin).toBe(cmin, msg + '| cmin');
expect(cOpts.cmax).toBe(cmax, msg + '| cmax');
};
}

Plotly.react(gd, fig([1, 2, 3]))
.then(_assert('marker.color [1,2,3]', 1, 3))
.then(function() { return Plotly.react(gd, fig([1, 5, 3])); })
.then(_assert('marker.color [1,5,3]', 1, 5))
.then(function() { return Plotly.react(gd, fig([1, 2, 3])); })
.then(_assert('back to marker.color [1,2,3]', 1, 3))
.then(function() { return Plotly.react(gd, fig([-1, 2, 3])); })
.then(_assert('marker.color [-1,2,3]', -1, 3))
.then(function() { return Plotly.react(gd, fig([1, 2, 3])); })
.then(_assert('back again to marker.color [1,2,3]', 1, 3))
.catch(failTest)
.then(done);
});

it('should work with templates', function(done) {
function _assert(msg, exp) {
var mcc = [];
Expand Down