Skip to content

Commit 414a9b8

Browse files
committed
clean up carpet pushing stuff back to _fullTrace late
except zmin/zmaxz, just ignore for now, we need to add these.
1 parent e9270fc commit 414a9b8

File tree

4 files changed

+15
-10
lines changed

4 files changed

+15
-10
lines changed

src/plot_api/plot_api.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -2440,8 +2440,13 @@ function getDiffFlags(oldContainer, newContainer, outerparts, opts) {
24402440
// FIXME: ax.tick0 and dtick get filled in during plotting, and unlike other auto values
24412441
// they don't make it back into the input, so newContainer won't have them.
24422442
// similar for axis ranges for 3D
2443-
if((key === 'tick0' || key === 'dtick') && newContainer.tickmode === 'auto') continue;
2443+
// contourcarpet doesn't HAVE zmin/zmax, they're just auto-added. It needs them.
2444+
if(key === 'tick0' || key === 'dtick') {
2445+
var tickMode = newContainer.tickmode;
2446+
if(tickMode === 'auto' || tickMode === 'array' || !tickMode) continue;
2447+
}
24442448
if(key === 'range' && newContainer.autorange) continue;
2449+
if((key === 'zmin' || key === 'zmax') && newContainer.type === 'contourcarpet') continue;
24452450

24462451
var parts = outerparts.concat(key);
24472452
valObject = getValObject(parts);

src/traces/carpet/calc.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ module.exports = function calc(gd, trace) {
3333
if(trace._cheater) {
3434
var avals = aax.cheatertype === 'index' ? a.length : a;
3535
var bvals = bax.cheatertype === 'index' ? b.length : b;
36-
trace.x = x = cheaterBasis(avals, bvals, trace.cheaterslope);
36+
x = cheaterBasis(avals, bvals, trace.cheaterslope);
3737
} else {
3838
x = trace.x;
3939
}
4040

41-
trace._x = trace.x = x = clean2dArray(x);
42-
trace._y = trace.y = y = clean2dArray(y);
41+
trace._x = x = clean2dArray(x);
42+
trace._y = y = clean2dArray(y);
4343

4444
// Fill in any undefined values with elliptic smoothing. This doesn't take
4545
// into account the spacing of the values. That is, the derivatives should

src/traces/carpet/calc_gridlines.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,7 @@ module.exports = function calcGridlines(trace, cd, axisLetter, crossAxisLetter)
2727
var crossAxis = trace[crossAxisLetter + 'axis'];
2828

2929
if(axis.tickmode === 'array') {
30-
axis.tickvals = [];
31-
for(i = 0; i < data.length; i++) {
32-
axis.tickvals.push(data[i]);
33-
}
30+
axis.tickvals = data.slice();
3431
}
3532

3633
var xcp = trace.xctrl;
@@ -42,6 +39,9 @@ module.exports = function calcGridlines(trace, cd, axisLetter, crossAxisLetter)
4239

4340
Axes.calcTicks(axis);
4441

42+
// don't leave tickvals in axis looking like an attribute
43+
if(axis.tickmode === 'array') delete axis.tickvals;
44+
4545
// The default is an empty array that will cause the join to remove the gridline if
4646
// it's just disappeared:
4747
// axis._startline = axis._endline = [];

src/traces/carpet/set_convert.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ module.exports = function setConvert(trace) {
6565
bax.c2p = function(v) { return v; };
6666

6767
trace.setScale = function() {
68-
var x = trace.x;
69-
var y = trace.y;
68+
var x = trace._x;
69+
var y = trace._y;
7070

7171
// This is potentially a very expensive step! It does the bulk of the work of constructing
7272
// an expanded basis of control points. Note in particular that it overwrites the existing

0 commit comments

Comments
 (0)