Skip to content

Commit f7fc31c

Browse files
committed
fix smith chart react
1 parent 354a7a1 commit f7fc31c

File tree

5 files changed

+23
-19
lines changed

5 files changed

+23
-19
lines changed

src/plots/smith/layout_attributes.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,10 @@ 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],
7677
valType: 'data_array',
7778
editType: 'plot',
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(' ')
79+
description: 'Sets the values at which ticks on this axis appear.'
8280
},
8381

8482
ticks: axesAttrs.ticks,

src/plots/smith/layout_defaults.js

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

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-
}
55+
coerceAxis('tickvals');
6656

6757
var dfltColor;
6858
var dfltFontColor;

test/image/mocks/smith_basic.json

+3
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
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]
2831
}
2932
}
3033
}

test/jasmine/tests/smith_test.js

+3-3
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(26, 'M-0.5,0h-5');
109+
check(12, 'M-0.5,0h-5');
110110
return Plotly.relayout(gd, 'smith.imaginaryaxis', {ticks: 'outside'});
111111
})
112112
.then(function() {
113-
check(26, 'M0.5,0h5');
113+
check(12, '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(26, 'M-0.5,0h-5');
121+
check(12, 'M-0.5,0h-5');
122122
})
123123
.then(done, done.fail);
124124
});

test/plot-schema.json

+14-1
Original file line numberDiff line numberDiff line change
@@ -7510,7 +7510,20 @@
75107510
"valType": "string"
75117511
},
75127512
"tickvals": {
7513-
"description": "Sets the values at which ticks on this axis appear. Defaults to `realaxis.tickvals` plus the same as negatives and zero.",
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+
],
75147527
"editType": "plot",
75157528
"valType": "data_array"
75167529
},

0 commit comments

Comments
 (0)