Skip to content

Commit 3380c0d

Browse files
committed
Revert "fix smith chart react"
This reverts commit f7fc31c.
1 parent 8fe37f4 commit 3380c0d

File tree

5 files changed

+19
-23
lines changed

5 files changed

+19
-23
lines changed

src/plots/smith/layout_attributes.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,12 @@ var imaginaryAxisAttrs = extendFlat({
7373
visible: extendFlat({}, axesAttrs.visible, {dflt: true}),
7474

7575
tickvals: {
76-
dflt: [-5, -2, -1, -0.5, -0.2, 0, 0.2, 0.5, 1, 2, 5],
7776
valType: 'data_array',
7877
editType: 'plot',
79-
description: 'Sets the values at which ticks on this axis appear.'
78+
description: [
79+
'Sets the values at which ticks on this axis appear.',
80+
'Defaults to `realaxis.tickvals` plus the same as negatives and zero.'
81+
].join(' ')
8082
},
8183

8284
ticks: axesAttrs.ticks,

src/plots/smith/layout_defaults.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,17 @@ function handleDefaults(contIn, contOut, coerce, opts) {
5252
var isRealAxis = axName === 'realaxis';
5353
if(isRealAxis) coerceAxis('side');
5454

55-
coerceAxis('tickvals');
55+
if(isRealAxis) {
56+
coerceAxis('tickvals');
57+
} else {
58+
var realTickvals = contOut.realaxis.tickvals || layoutAttributes.realaxis.tickvals.dflt;
59+
var imagTickvalsDflt =
60+
realTickvals.slice().reverse().map(function(x) { return -x; })
61+
.concat([0])
62+
.concat(realTickvals);
63+
64+
coerceAxis('tickvals', imagTickvalsDflt);
65+
}
5666

5767
var dfltColor;
5868
var dfltFontColor;

test/image/mocks/smith_basic.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@
2525
"smith": {
2626
"realaxis": {
2727
"tickvals": [0.2, 0.4, 0.6, 0.8, 1, 1.5, 2, 3, 4, 5, 10, 20]
28-
},
29-
"imaginaryaxis": {
30-
"tickvals": [-20, -10, -5, -4, -3, -2, -1.5, -1, -0.8, -0.6, -0.4, -0.2, 0, 0.2, 0.4, 0.6, 0.8, 1, 1.5, 2, 3, 4, 5, 10, 20]
3128
}
3229
}
3330
}

test/jasmine/tests/smith_test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,19 +106,19 @@ describe('Test relayout on smith subplots:', function() {
106106
return Plotly.relayout(gd, 'smith.imaginaryaxis', {ticks: 'inside'});
107107
})
108108
.then(function() {
109-
check(12, 'M-0.5,0h-5');
109+
check(26, 'M-0.5,0h-5');
110110
return Plotly.relayout(gd, 'smith.imaginaryaxis', {ticks: 'outside'});
111111
})
112112
.then(function() {
113-
check(12, 'M0.5,0h5');
113+
check(26, 'M0.5,0h5');
114114
return Plotly.relayout(gd, 'smith.imaginaryaxis', {ticks: ''});
115115
})
116116
.then(function() {
117117
check(0);
118118
return Plotly.relayout(gd, 'smith.imaginaryaxis', {ticks: 'inside'});
119119
})
120120
.then(function() {
121-
check(12, 'M-0.5,0h-5');
121+
check(26, 'M-0.5,0h-5');
122122
})
123123
.then(done, done.fail);
124124
});

test/plot-schema.json

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7510,20 +7510,7 @@
75107510
"valType": "string"
75117511
},
75127512
"tickvals": {
7513-
"description": "Sets the values at which ticks on this axis appear.",
7514-
"dflt": [
7515-
-5,
7516-
-2,
7517-
-1,
7518-
-0.5,
7519-
-0.2,
7520-
0,
7521-
0.2,
7522-
0.5,
7523-
1,
7524-
2,
7525-
5
7526-
],
7513+
"description": "Sets the values at which ticks on this axis appear. Defaults to `realaxis.tickvals` plus the same as negatives and zero.",
75277514
"editType": "plot",
75287515
"valType": "data_array"
75297516
},

0 commit comments

Comments
 (0)