Skip to content

Commit

Permalink
Merge pull request #7234 from plotly/drop-zauto-zmin-zmax
Browse files Browse the repository at this point in the history
Drop deprecated `zauto`, `zmin` and `zmax` from the surface trace
  • Loading branch information
archmoj authored Oct 17, 2024
2 parents d010201 + 5afc63b commit 2be6fcc
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 71 deletions.
1 change: 1 addition & 0 deletions draftlogs/7234_remove.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Drop deprecated zauto, zmin and zmax from the surface trace [[#7234](https://github.com/plotly/plotly.js/pull/7234)]
12 changes: 0 additions & 12 deletions src/traces/surface/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,18 +288,6 @@ colorScaleAttrs('', {
].join(' ')
},

_deprecated: {
zauto: extendFlat({}, colorScaleAttrs.zauto, {
description: 'Obsolete. Use `cauto` instead.'
}),
zmin: extendFlat({}, colorScaleAttrs.zmin, {
description: 'Obsolete. Use `cmin` instead.'
}),
zmax: extendFlat({}, colorScaleAttrs.zmax, {
description: 'Obsolete. Use `cmax` instead.'
})
},

hoverinfo: extendFlat({}, baseAttrs.hoverinfo),
showlegend: extendFlat({}, baseAttrs.showlegend, {dflt: false}),
}), 'calc', 'nested');
Expand Down
13 changes: 0 additions & 13 deletions src/traces/surface/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,6 @@ function supplyDefaults(traceIn, traceOut, defaultColor, layout) {
coerce(contourDim + '.size');
}

// backward compatibility block
if(!surfaceColor) {
mapLegacy(traceIn, 'zmin', 'cmin');
mapLegacy(traceIn, 'zmax', 'cmax');
mapLegacy(traceIn, 'zauto', 'cauto');
}

// TODO if contours.?.usecolormap are false and hidesurface is true
// the colorbar shouldn't be shown by default

Expand Down Expand Up @@ -155,12 +148,6 @@ function opacityscaleDefaults(traceIn, traceOut, layout, coerce) {
}
}

function mapLegacy(traceIn, oldAttr, newAttr) {
if(oldAttr in traceIn && !(newAttr in traceIn)) {
traceIn[newAttr] = traceIn[oldAttr];
}
}

module.exports = {
supplyDefaults: supplyDefaults,
opacityscaleDefaults: opacityscaleDefaults
Expand Down
1 change: 0 additions & 1 deletion tasks/test_mock.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ function notBlackListed(name) {
'gl2d_text_chart_single-string',
'gl2d_text_chart_styling',
'gl2d_texttemplate',
'gl3d_autocolorscale',
'gl3d_bunny',
'gl3d_bunny-hull',
'gl3d_coloraxes',
Expand Down
4 changes: 2 additions & 2 deletions test/image/mocks/gl3d_autocolorscale.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
["zero two", "one two", "two two"]
],
"autocolorscale": true,
"zmin": 0,
"zmax": "50"
"cmin": 0,
"cmax": "50"
}
],
"layout": {
Expand Down
29 changes: 0 additions & 29 deletions test/jasmine/tests/surface_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,35 +107,6 @@ describe('Test surface', function() {
expect(traceOut.colorbar).toBeDefined();
});

it('should coerce \'c\' attributes with \'z\' if \'c\' isn\'t present', function() {
traceIn = {
z: [[1, 2, 3], [2, 1, 2]],
zauto: false,
zmin: 0,
zmax: 10
};

supplyDefaults(traceIn, traceOut, defaultColor, layout);
expect(traceOut.cauto).toEqual(false);
expect(traceOut.cmin).toEqual(0);
expect(traceOut.cmax).toEqual(10);
});

it('should coerce \'c\' attributes with \'c\' values regardless of `\'z\' if \'c\' is present', function() {
traceIn = {
z: [[1, 2, 3], [2, 1, 2]],
zmin: 0,
zmax: 10,
cmin: -10,
cmax: 20
};

supplyDefaults(traceIn, traceOut, defaultColor, layout);
expect(traceOut.cauto).toEqual(false);
expect(traceOut.cmin).toEqual(-10);
expect(traceOut.cmax).toEqual(20);
});

it('should default \'c\' attributes with if \'surfacecolor\' is present', function() {
traceIn = {
z: [[1, 2, 3], [2, 1, 2]],
Expand Down
14 changes: 0 additions & 14 deletions test/plot-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -88601,20 +88601,6 @@
"surface": {
"animatable": false,
"attributes": {
"_deprecated": {
"zauto": {
"description": "Obsolete. Use `cauto` instead.",
"editType": "calc"
},
"zmax": {
"description": "Obsolete. Use `cmax` instead.",
"editType": "calc"
},
"zmin": {
"description": "Obsolete. Use `cmin` instead.",
"editType": "calc"
}
},
"autocolorscale": {
"description": "Determines whether the colorscale is a default palette (`autocolorscale: true`) or the palette determined by `colorscale`. In case `colorscale` is unspecified or `autocolorscale` is true, the default palette will be chosen according to whether numbers in the `color` array are all positive, all negative or mixed.",
"dflt": false,
Expand Down

0 comments on commit 2be6fcc

Please sign in to comment.