Skip to content

Commit 52ab89c

Browse files
committed
rename zmin,zmax,zauto,intensity to cmin,cmax,cauto,surfacecolor
1 parent 00109fd commit 52ab89c

File tree

6 files changed

+27
-19
lines changed

6 files changed

+27
-19
lines changed

src/plot_api/plot_api.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -761,6 +761,11 @@ function cleanData(data, existingData) {
761761
if(cont.colorscale === 'YIGnBu') cont.colorscale = 'YlGnBu';
762762
if(cont.colorscale === 'YIOrRd') cont.colorscale = 'YlOrRd';
763763
}
764+
if(Plots.traceIs(trace, 'surface')) {
765+
if('zmin' in trace) trace.cmin = trace.zmin
766+
if('zmax' in trace) trace.cmax = trace.zmax
767+
if('zauto' in trace) trace.cauto = trace.zauto
768+
}
764769

765770
// prune empty containers made before the new nestedProperty
766771
if(emptyContainer(trace, 'line')) delete trace.line;

src/traces/surface/attributes.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,16 +95,16 @@ module.exports = {
9595
valType: 'data_array',
9696
description: 'Sets the text elements associated with each z value.'
9797
},
98-
intensity: {
98+
surfacecolor: {
9999
valType: 'data_array',
100100
description: [
101101
'Sets the surface intensity values,',
102102
'used for setting a color scale independent of z'
103103
].join(' ')
104104
},
105-
zauto: colorscaleAttrs.zauto,
106-
zmin: colorscaleAttrs.zmin,
107-
zmax: colorscaleAttrs.zmax,
105+
cauto: colorscaleAttrs.zauto,
106+
cmin: colorscaleAttrs.zmin,
107+
cmax: colorscaleAttrs.zmax,
108108
colorscale: colorscaleAttrs.colorscale,
109109
autocolorscale: extendFlat({}, colorscaleAttrs.autocolorscale,
110110
{dflt: false}),
@@ -168,5 +168,11 @@ module.exports = {
168168

169169
_nestedModules: { // nested module coupling
170170
'colorbar': 'Colorbar'
171+
},
172+
173+
_deprecated: {
174+
zauto: colorscaleAttrs.zauto,
175+
zmin: colorscaleAttrs.zmin,
176+
zmax: colorscaleAttrs.zmax
171177
}
172178
};

src/traces/surface/calc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ var colorscaleCalc = require('../../components/colorscale/calc');
1515
// Compute auto-z and autocolorscale if applicable
1616
module.exports = function calc(gd, trace) {
1717
if(trace.intensity) {
18-
colorscaleCalc(trace, trace.intensity, '', 'intensity');
18+
colorscaleCalc(trace, trace.surfacecolor, '', 'c');
1919
} else {
2020
colorscaleCalc(trace, trace.z, '', 'z');
2121
}

src/traces/surface/convert.js

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -245,28 +245,26 @@ proto.update = function(data) {
245245
dynamicColor: [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]],
246246
dynamicWidth: [1, 1, 1],
247247
dynamicTint: [1, 1, 1],
248-
opacity: 1
249-
// TODO: Need to think about how to calculate this
250-
/*
251-
intensityBounds: [
252-
data.zmin * scaleFactor[2],
253-
data.zmax * scaleFactor[2]]
254-
*/
248+
opacity: 1,
255249
};
256250

251+
if('cmin' in data && 'cmax' in data) {
252+
params.intensityBounds = [ data.cmin, data.cmax ]
253+
}
254+
257255
//Refine if necessary
258-
if('intensity' in data) {
256+
if(data.surfacecolor) {
259257
var intensity = ndarray(
260258
new Float32Array(xlen * ylen), [xlen, ylen]);
261259
fill(intensity, function(row, col) {
262-
return data.intensity[col][row];
260+
return data.surfacecolor[col][row];
263261
});
264262
coords.push(intensity);
265263
}
266264

267265
this.dataScale = refine(coords);
268266

269-
if('intensity' in data) {
267+
if(data.surfacecolor) {
270268
params.intensity = coords.pop();
271269
}
272270

@@ -317,7 +315,6 @@ proto.update = function(data) {
317315

318316
params.coords = coords;
319317

320-
321318
surface.update(params);
322319

323320
surface.highlightEnable = highlightEnable;

src/traces/surface/defaults.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
5858
coerce('hidesurface');
5959
coerce('opacity');
6060

61-
coerce('intensity');
61+
coerce('surfacecolor');
6262

6363
coerce('colorscale');
6464

@@ -88,6 +88,6 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
8888
}
8989

9090
colorscaleDefaults(
91-
traceIn, traceOut, layout, coerce, {prefix: '', cLetter: 'z'}
91+
traceIn, traceOut, layout, coerce, {prefix: '', cLetter: 'c'}
9292
);
9393
};

test/image/mocks/gl3d_surface_intensity.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@
123123
-0.904072142017061
124124
]
125125
],
126-
"intensity": [
126+
"surfacecolor": [
127127
[
128128
10,
129129
9,

0 commit comments

Comments
 (0)