Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8ace040

Browse files
committed
Remove sector attribute
1 parent b26f21c commit 8ace040

File tree

4 files changed

+10
-95
lines changed

4 files changed

+10
-95
lines changed

src/plots/smith/layout_attributes.js

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -139,21 +139,6 @@ module.exports = {
139139

140140
domain: domainAttrs({name: 'smith', editType: 'plot'}),
141141

142-
sector: {
143-
valType: 'info_array',
144-
items: [
145-
{valType: 'number', editType: 'plot'},
146-
{valType: 'number', editType: 'plot'}
147-
],
148-
dflt: [0, 360],
149-
editType: 'plot',
150-
description: [
151-
'Sets angular span of this smith subplot with two angles (in degrees).',
152-
'Sector are assumed to be spanned in the counterclockwise direction',
153-
'with *0* corresponding to rightmost limit of the smith subplot.'
154-
].join(' ')
155-
},
156-
157142
bgcolor: {
158143
valType: 'color',
159144
editType: 'plot',

src/plots/smith/layout_defaults.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ function handleDefaults(contIn, contOut, coerce, opts) {
1919
var bgColor = coerce('bgcolor');
2020
opts.bgColor = Color.combine(bgColor, opts.paper_bgcolor);
2121

22-
coerce('sector');
23-
2422
// could optimize, subplotData is not always needed!
2523
var subplotData = getSubplotData(opts.fullData, constants.name, opts.id);
2624
var layoutOut = opts.layoutOut;

src/plots/smith/set_convert.js

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -170,30 +170,17 @@ function setConvertAngular(ax, smithLayout) {
170170

171171
// N.B. we mock the axis 'range' here
172172
ax.setGeometry = function() {
173-
var sector = smithLayout.sector;
174-
var sectorInRad = sector.map(deg2rad);
175-
var dir = {clockwise: -1, counterclockwise: 1}[ax.direction];
176-
var rot = deg2rad(ax.rotation);
177-
178-
var rad2g = function(v) { return dir * v + rot; };
179-
var g2rad = function(v) { return (v - rot) / dir; };
173+
var rad2g = function(v) { return v; };
174+
var g2rad = function(v) { return v; };
180175

181176
var rad2c, c2rad;
182177
var rad2t, t2rad;
183178

184-
switch(axType) {
185-
case 'linear':
186-
c2rad = rad2c = Lib.identity;
187-
t2rad = deg2rad;
188-
rad2t = rad2deg;
189-
190-
// Set the angular range in degrees to make auto-tick computation cleaner,
191-
// changing rotation/direction should not affect the angular tick value.
192-
ax.range = Lib.isFullCircle(sectorInRad) ?
193-
[sector[0], sector[0] + 360] :
194-
sectorInRad.map(g2rad).map(rad2deg);
195-
break;
196-
}
179+
c2rad = rad2c = Lib.identity;
180+
t2rad = deg2rad;
181+
rad2t = rad2deg;
182+
183+
ax.range = [0, 360];
197184

198185
ax.c2g = function(v) { return rad2g(c2rad(v)); };
199186
ax.g2c = function(v) { return rad2c(g2rad(v)); };

src/plots/smith/smith.js

Lines changed: 3 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,9 @@ proto.updateLayout = function(fullLayout, smithLayout) {
195195
var xLength = _this.xLength = gs.w * (xDomain[1] - xDomain[0]);
196196
var yLength = _this.yLength = gs.h * (yDomain[1] - yDomain[0]);
197197
// sector to plot
198-
var sector = smithLayout.sector;
198+
var sector = [0, 360];
199199
_this.sectorInRad = sector.map(deg2rad);
200-
var sectorBBox = _this.sectorBBox = computeSectorBBox(sector);
200+
var sectorBBox = _this.sectorBBox = [-1, -1, 1, 1];
201201
var dxSectorBBox = sectorBBox[2] - sectorBBox[0];
202202
var dySectorBBox = sectorBBox[3] - sectorBBox[1];
203203
// aspect ratios
@@ -349,7 +349,7 @@ proto.updateRadialAxis = function(fullLayout, smithLayout) {
349349
var cx = _this.cx;
350350
var cy = _this.cy;
351351
var radialLayout = smithLayout.realaxis;
352-
var a0 = mod(smithLayout.sector[0], 360);
352+
var a0 = 0;
353353
var ax = _this.radialAxis;
354354
var hasRoomForIt = true;
355355

@@ -1043,61 +1043,6 @@ function strTickLayout(axLayout) {
10431043
return out;
10441044
}
10451045

1046-
// Finds the bounding box of a given circle sector,
1047-
// inspired by https://math.stackexchange.com/q/1852703
1048-
//
1049-
// assumes:
1050-
// - sector[0] < sector[1]
1051-
// - counterclockwise rotation
1052-
function computeSectorBBox(sector) {
1053-
var s0 = sector[0];
1054-
var s1 = sector[1];
1055-
var arc = s1 - s0;
1056-
var a0 = mod(s0, 360);
1057-
var a1 = a0 + arc;
1058-
1059-
var ax0 = Math.cos(deg2rad(a0));
1060-
var ay0 = Math.sin(deg2rad(a0));
1061-
var ax1 = Math.cos(deg2rad(a1));
1062-
var ay1 = Math.sin(deg2rad(a1));
1063-
1064-
var x0, y0, x1, y1;
1065-
1066-
if((a0 <= 90 && a1 >= 90) || (a0 > 90 && a1 >= 450)) {
1067-
y1 = 1;
1068-
} else if(ay0 <= 0 && ay1 <= 0) {
1069-
y1 = 0;
1070-
} else {
1071-
y1 = Math.max(ay0, ay1);
1072-
}
1073-
1074-
if((a0 <= 180 && a1 >= 180) || (a0 > 180 && a1 >= 540)) {
1075-
x0 = -1;
1076-
} else if(ax0 >= 0 && ax1 >= 0) {
1077-
x0 = 0;
1078-
} else {
1079-
x0 = Math.min(ax0, ax1);
1080-
}
1081-
1082-
if((a0 <= 270 && a1 >= 270) || (a0 > 270 && a1 >= 630)) {
1083-
y0 = -1;
1084-
} else if(ay0 >= 0 && ay1 >= 0) {
1085-
y0 = 0;
1086-
} else {
1087-
y0 = Math.min(ay0, ay1);
1088-
}
1089-
1090-
if(a1 >= 360) {
1091-
x1 = 1;
1092-
} else if(ax0 <= 0 && ax1 <= 0) {
1093-
x1 = 0;
1094-
} else {
1095-
x1 = Math.max(ax0, ax1);
1096-
}
1097-
1098-
return [x0, y0, x1, y1];
1099-
}
1100-
11011046
function snapToVertexAngle(a, vangles) {
11021047
var fn = function(v) { return Lib.angleDist(a, v); };
11031048
var ind = Lib.findIndexOfMin(vangles, fn);

0 commit comments

Comments
 (0)