Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce smith subplot and scattersmith trace type #5956

Merged
merged 140 commits into from
Oct 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
140 commits
Select commit Hold shift + click to select a range
9492c99
Add a dummy scattersmith trace
waxlamp Apr 5, 2021
2ac5084
Modify scattersmith trace to use `re` and `im` data series
waxlamp Apr 20, 2021
9366507
Perform gamma transform (with fixed z0 of unity)
waxlamp Apr 21, 2021
e45b7b8
Force smith chart to use radial range [0, 1]
waxlamp Apr 21, 2021
6425813
Add a WIP function to draw circular "real" lines
waxlamp Apr 28, 2021
f7cd0b0
WIP
waxlamp Jun 9, 2021
3914dc0
Display real ticks at 0.2, 0.5, 1.0, 2.0, 5.0
waxlamp Jun 9, 2021
97a2224
Draw grid lines for imaginary axis
waxlamp Jun 9, 2021
e2f6abd
Draw imaginary axis line properly
waxlamp Jun 9, 2021
7cbf9bc
Clip imaginary axis grid lines to correct angular bounds
waxlamp Jun 9, 2021
7a6f86c
Draw imaginary axis tick labels
waxlamp Jun 16, 2021
edee054
Draw tick labels for real axis
waxlamp Jun 16, 2021
eeba96d
Adjust placement of real axis tick labels
waxlamp Jun 16, 2021
be8a250
Automatic lint fixes
waxlamp Jun 18, 2021
17e60c0
Restrict points to within the smith chart area
waxlamp Jun 18, 2021
c821377
Fix non-automatic lint errors
waxlamp Jun 18, 2021
7ee57e6
Add mock and baseline for smith chart
waxlamp Jun 30, 2021
dc43dd1
Add "smith_lines" baseline
waxlamp Jul 7, 2021
2d6b6bf
Update smith_basic baseline
waxlamp Jul 7, 2021
bb444af
Add "smith_axes" mock and baseline
waxlamp Jul 7, 2021
0fcb0fe
Merge remote-tracking branch 'origin/master' into smith
waxlamp Jul 7, 2021
2abb96c
Update plot-schema.json
waxlamp Jul 7, 2021
166199a
Fix mock validation errors
waxlamp Jul 8, 2021
7346245
Add smith chart to list of subplots
waxlamp Jul 8, 2021
7e67229
Force smith mocks to run at the end
waxlamp Jul 8, 2021
1eb2d51
Rename "radialaxis" to "realaxis"
waxlamp Jul 16, 2021
202d4a5
Rename angularaxis to imaginaryaxis
waxlamp Jul 16, 2021
ce8f742
Merge remote-tracking branch 'origin/master' into smith
waxlamp Jul 19, 2021
7e3e69c
Disable unnecessary tick options
waxlamp Jul 28, 2021
71148d2
Remove options for axis types
waxlamp Jul 28, 2021
61ed436
Remove range options
waxlamp Jul 28, 2021
b822f04
Remove axis processing code for imaginary axis
waxlamp Jul 28, 2021
de9770d
Remove category options
waxlamp Jul 28, 2021
ed8c75a
Remove thetaunit option
waxlamp Jul 28, 2021
afd67e6
Remove period option
waxlamp Jul 28, 2021
06e0c59
Add a scattersmith test
waxlamp Aug 3, 2021
1dc00c7
Add a smith plot react test
waxlamp Aug 3, 2021
135a6e5
Merge remote-tracking branch 'origin/master' into smith
waxlamp Aug 3, 2021
eb94f46
Fix lint errors
waxlamp Aug 3, 2021
dee7fc9
Update schema diff
waxlamp Aug 3, 2021
7dc4ac8
Remove invalid options from mock
waxlamp Aug 3, 2021
6258e63
Remove "polar" category from smith trace
waxlamp Aug 4, 2021
752226b
Remove unnecessary function
waxlamp Aug 4, 2021
03c78eb
Update plot description
waxlamp Aug 4, 2021
df36ae3
Remove `angle` and `side` options from realaxis
waxlamp Aug 4, 2021
83189cf
Change "polar" to "smith"
waxlamp Aug 4, 2021
090251f
Remove deprecated attributes
waxlamp Aug 4, 2021
eddfcde
Rename "polar" to "smith" where definitely possible
waxlamp Aug 4, 2021
66ff9c1
Fix lint errors
waxlamp Aug 4, 2021
7246742
Update plot-schema diff
waxlamp Aug 4, 2021
5d6b528
Update baselines
waxlamp Aug 4, 2021
8676ed2
Merge remote-tracking branch 'origin/master' into smith
waxlamp Aug 4, 2021
316be5c
Rename polar to smith
waxlamp Aug 6, 2021
43a3be8
Remove references to GL versions of smith plot
waxlamp Aug 6, 2021
fdf7776
Remove commented-out lines
waxlamp Aug 6, 2021
8d97671
Remove commented-out code
waxlamp Aug 10, 2021
cb07c28
Refactor constant value lists into variables
waxlamp Aug 10, 2021
2ca14f9
Remove 'backplot' layer and unused drag logic
waxlamp Aug 10, 2021
5c83a18
Reuse polar/helpers.js
waxlamp Aug 10, 2021
8f67a6b
Remove GL logic
waxlamp Aug 10, 2021
e7b47da
Use Lib.bigFont()
waxlamp Aug 10, 2021
3853720
Remove logic to handle category type
waxlamp Aug 10, 2021
e17fcef
Remove category type logic
waxlamp Aug 10, 2021
9c9806e
Remove `hoverinfo` attribute
waxlamp Aug 10, 2021
bb59e34
Remove `texttemplate` attributes
waxlamp Aug 10, 2021
3a9648d
Add hover test for smith plot
waxlamp Aug 11, 2021
736cf2c
Add smith plot test
waxlamp Aug 11, 2021
33edd05
Use option fonts to control tick label rendering
waxlamp Aug 11, 2021
5605f78
Change "name" attr to "smith"
waxlamp Aug 11, 2021
9861349
Rename polarsublayer to smithsublayer
waxlamp Aug 11, 2021
23c1aed
Add and use a `_smithlayer`
waxlamp Aug 11, 2021
f6c748c
Rename axis attr variables
waxlamp Aug 13, 2021
b26f21c
Remove `hole` attribute
waxlamp Aug 13, 2021
8ace040
Remove `sector` attribute
waxlamp Aug 13, 2021
021d708
Remove `gridshape` attribute
waxlamp Aug 13, 2021
80de25d
Remove conditions on 'linear' type
waxlamp Aug 13, 2021
6aabf51
Remove unnecessary type check
waxlamp Aug 13, 2021
8351bfa
Remove unused zoom functions
waxlamp Aug 13, 2021
71eedaa
Remove other drag infrastructure
waxlamp Aug 13, 2021
6b0f08f
Remove the rest of the zoom infrastructure
waxlamp Aug 13, 2021
0063041
Restore texttemplate feature
waxlamp Aug 14, 2021
52f53ce
Merge remote-tracking branch 'origin/master' into smith
waxlamp Aug 16, 2021
d5ad834
Autofix lint errors
waxlamp Aug 16, 2021
994bd49
Remove category axis type processing
waxlamp Aug 16, 2021
d25ea5a
Update schema
waxlamp Aug 16, 2021
e18c8e8
Enable default fonts if spec doesn't specify any
waxlamp Aug 16, 2021
25c75e4
Regenerate baselines
waxlamp Aug 16, 2021
600eee1
Remove unnecessary constants
waxlamp Aug 16, 2021
0128452
Restore selection behavior
waxlamp Aug 16, 2021
c2b84ec
Fix lint errors
waxlamp Aug 16, 2021
d9f8b24
Add select test for scattersmith
waxlamp Aug 16, 2021
14a64c6
Use light blue bgcolor for zzz_smith_line
waxlamp Aug 18, 2021
6fdabfc
Use dark blue bgcolor in zzz_smith_line baseline
waxlamp Aug 18, 2021
08e4e63
Use gray paper bgcolor for smith axes baseline
waxlamp Aug 18, 2021
7f8cb5d
Update baselines
waxlamp Aug 18, 2021
5a329da
Add text labels to baselines
waxlamp Aug 18, 2021
aa13b91
Add baseline for connectgaps
waxlamp Aug 18, 2021
ffd19e7
Add a scattersmith mock to the mock list
waxlamp Aug 18, 2021
383b6f1
Add fill baseline
waxlamp Aug 18, 2021
7da2e28
Add a single plot baseline
waxlamp Sep 1, 2021
fd0f370
Coerce `hoverformat`
waxlamp Sep 1, 2021
c1613b2
Add tests modeled after tests in polar
waxlamp Sep 1, 2021
56e0a97
Merge pull request #5615 from arclamp/smith
archmoj Sep 27, 2021
60c30f4
revise smith
archmoj Sep 29, 2021
6eae41c
Merge remote-tracking branch 'origin/master' into smith-prototype
archmoj Sep 30, 2021
5c720db
add smith chart to plot_api_react test
archmoj Sep 30, 2021
065c4ea
remove unsupported Infinity from smith mock
archmoj Sep 30, 2021
3e53615
no need to add smith axes to axList
archmoj Sep 30, 2021
54d2ca2
refactor - avoid long _hasClipOnAxisFalse key twice
archmoj Sep 30, 2021
8796e76
delete range from smith axis at the end of plot
archmoj Sep 30, 2021
bc8863c
no real axis title
archmoj Sep 30, 2021
3fe6fd2
default cliponaxis to false similar to polar - adjust mocks
archmoj Sep 30, 2021
873d5ea
Merge remote-tracking branch 'origin/master' into smith-prototype
archmoj Oct 1, 2021
d8b9ba2
Merge remote-tracking branch 'origin/master' into smith-prototype
archmoj Oct 1, 2021
e367b07
fix and add hover test for prefix and tickformat
archmoj Oct 1, 2021
b9ed688
limit smith interactions to hover, select and click
archmoj Oct 1, 2021
ef90f13
improve smith test for prefix, suffix and tickangle
archmoj Oct 1, 2021
743d06c
drop unused attributes from smith
archmoj Oct 1, 2021
f2390d3
no showexponent for smith
archmoj Oct 1, 2021
8ec732f
clear ax._m and copied comments from polar
archmoj Oct 1, 2021
4f5f227
remove smith setConvert - reuse cartesian
archmoj Oct 1, 2021
2a4a8a3
clear copied TODO comment from polar
archmoj Oct 1, 2021
3c5df3e
rename mocks from zzz_smith to smith
archmoj Oct 5, 2021
76c4871
improve smith chart tests - use gradient options
archmoj Oct 8, 2021
e485e86
improve smith chart tests - colorscale and dash
archmoj Oct 8, 2021
87a9f46
update baseline
archmoj Oct 8, 2021
ea16526
Merge remote-tracking branch 'origin/master' into smith-prototype
archmoj Oct 8, 2021
06ea178
Merge remote-tracking branch 'origin/master' into smith-prototype
archmoj Oct 18, 2021
73d37a6
cleanup unused logic
archmoj Oct 18, 2021
b5c2ec6
remove comment
archmoj Oct 18, 2021
6c8ab02
remove unused smith invert function until spikes needed
archmoj Oct 18, 2021
f4245d0
simplify smith helpers
archmoj Oct 18, 2021
475a6f1
use isFinite to test for infinities
archmoj Oct 18, 2021
cdba977
update smith_gaps baseline
archmoj Oct 18, 2021
edf124e
refactor smith layout_attributes
archmoj Oct 18, 2021
32fde3b
Update src/plots/polar/polar.js
archmoj Oct 18, 2021
cb1b4b4
update baselines
archmoj Oct 19, 2021
cacf161
increase the size of infinity
archmoj Oct 19, 2021
d30416d
improve description for real and imaginary components
archmoj Oct 19, 2021
cfa96e5
inherit imaginary tickvals default from real axis
archmoj Oct 19, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ Plotly.register([
require('./scatterpolar'),
require('./scatterpolargl'),
require('./barpolar'),
require('./scattersmith'),

// transforms
require('./aggregate'),
Expand Down
3 changes: 3 additions & 0 deletions lib/scattersmith.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
'use strict';

module.exports = require('../src/traces/scattersmith');
5 changes: 3 additions & 2 deletions src/components/modebar/manage.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ function getButtonGroups(gd) {
var hasTernary = fullLayout._has('ternary');
var hasMapbox = fullLayout._has('mapbox');
var hasPolar = fullLayout._has('polar');
var hasSmith = fullLayout._has('smith');
var hasSankey = fullLayout._has('sankey');
var allAxesFixed = areAllAxesFixed(fullLayout);
var hasUnifiedHoverLabel = isUnifiedHover(fullLayout.hovermode);
Expand Down Expand Up @@ -152,7 +153,7 @@ function getButtonGroups(gd) {
var resetGroup = [];
var dragModeGroup = [];

if((hasCartesian || hasGL2D || hasPie || hasFunnelarea || hasTernary) + hasGeo + hasGL3D + hasMapbox + hasPolar > 1) {
if((hasCartesian || hasGL2D || hasPie || hasFunnelarea || hasTernary) + hasGeo + hasGL3D + hasMapbox + hasPolar + hasSmith > 1) {
// graphs with more than one plot types get 'union buttons'
// which reset the view or toggle hover labels across all subplots.
hoverGroup = ['toggleHover'];
Expand All @@ -175,7 +176,7 @@ function getButtonGroups(gd) {
} else if(hasSankey) {
hoverGroup = ['hoverClosestCartesian', 'hoverCompareCartesian'];
resetGroup = ['resetViewSankey'];
} else { // hasPolar, hasTernary
} else { // hasPolar, hasSmith, hasTernary
// always show at least one hover icon.
hoverGroup = ['toggleHover'];
}
Expand Down
3 changes: 3 additions & 0 deletions src/plot_api/plot_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -3729,6 +3729,9 @@ function makePlotFramework(gd) {
// single polar layer for the whole plot
fullLayout._polarlayer = fullLayout._paper.append('g').classed('polarlayer', true);

// single smith layer for the whole plot
fullLayout._smithlayer = fullLayout._paper.append('g').classed('smithlayer', true);

// single ternary layer for the whole plot
fullLayout._ternarylayer = fullLayout._paper.append('g').classed('ternarylayer', true);

Expand Down
4 changes: 2 additions & 2 deletions src/plots/cartesian/axes.js
Original file line number Diff line number Diff line change
Expand Up @@ -1462,7 +1462,7 @@ function formatDate(ax, out, hover, extraPrecision) {
dateStr += '<br>' + headStr;
} else {
var isInside = insideTicklabelposition(ax);
var side = ax._realSide || ax.side; // polar mocks the side of the radial axis
var side = ax._trueSide || ax.side; // polar mocks the side of the radial axis
if(
(!isInside && side === 'top') ||
(isInside && side === 'bottom')
Expand Down Expand Up @@ -3269,7 +3269,7 @@ axes.drawLabels = function(gd, ax, opts) {
var pad = !isAligned ? 0 :
(ax.tickwidth || 0) + 2 * TEXTPAD;

var rotate90 = (tickSpacing < maxFontSize * 2.5) || ax.type === 'multicategory';
var rotate90 = (tickSpacing < maxFontSize * 2.5) || ax.type === 'multicategory' || ax._name === 'realaxis';

// any overlap at all - set 30 degrees or 90 degrees
for(i = 0; i < lbbArray.length - 1; i++) {
Expand Down
1 change: 1 addition & 0 deletions src/plots/cartesian/set_convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,7 @@ module.exports = function setConvert(ax, fullLayout) {

if(ax.type === 'date') dflt = Lib.dfltRange(ax.calendar);
else if(axLetter === 'y') dflt = constants.DFLTRANGEY;
else if(ax._name === 'realaxis') dflt = [0, 1];
else dflt = opts.dfltRange || constants.DFLTRANGEX;

// make sure we don't later mutate the defaults
Expand Down
5 changes: 3 additions & 2 deletions src/plots/cartesian/tick_label_defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ module.exports = function handleTickLabelDefaults(containerIn, containerOut, coe
size: font.size,
color: dfltFontColor
});
coerce('tickangle');

if(!options.noAng) coerce('tickangle');

if(axType !== 'category') {
var tickFormat = coerce('tickformat');
Expand All @@ -41,7 +42,7 @@ module.exports = function handleTickLabelDefaults(containerIn, containerOut, coe
delete containerOut.tickformatstops;
}

if(!tickFormat && axType !== 'date') {
if(!options.noExp && !tickFormat && axType !== 'date') {
coerce('showexponent', showAttrDflt);
coerce('exponentformat');
coerce('minexponent');
Expand Down
2 changes: 1 addition & 1 deletion src/plots/cartesian/tick_mark_defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ var layoutAttributes = require('./layout_attributes');
/**
* options: inherits outerTicks from axes.handleAxisDefaults
*/
module.exports = function handleTickDefaults(containerIn, containerOut, coerce, options) {
module.exports = function handleTickMarkDefaults(containerIn, containerOut, coerce, options) {
var tickLen = Lib.coerce2(containerIn, containerOut, layoutAttributes, 'ticklen');
var tickWidth = Lib.coerce2(containerIn, containerOut, layoutAttributes, 'tickwidth');
var tickColor = Lib.coerce2(containerIn, containerOut, layoutAttributes, 'tickcolor', containerOut.color);
Expand Down
63 changes: 31 additions & 32 deletions src/plots/polar/layout_defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,6 @@ function handleDefaults(contIn, contOut, coerce, opts) {

coerceAxis('uirevision', contOut.uirevision);

var dfltColor;
var dfltFontColor;

if(visible) {
dfltColor = coerceAxis('color');
dfltFontColor = (dfltColor === axIn.color) ? dfltColor : opts.font.color;
}

// We don't want to make downstream code call ax.setScale,
// as both radial and angular axes don't have a set domain.
// Furthermore, angular axes don't have a set range.
Expand All @@ -91,18 +83,6 @@ function handleDefaults(contIn, contOut, coerce, opts) {

coerceAxis('range');
axOut.cleanRange('range', {dfltRange: [0, 1]});

if(visible) {
coerceAxis('side');
coerceAxis('angle', sector[0]);

coerceAxis('title.text');
Lib.coerceFont(coerceAxis, 'title.font', {
family: opts.font.family,
size: Lib.bigFont(opts.font.size),
color: dfltFontColor
});
}
break;

case 'angularaxis':
Expand Down Expand Up @@ -142,20 +122,27 @@ function handleDefaults(contIn, contOut, coerce, opts) {
});

if(visible) {
var dfltColor;
var dfltFontColor;
var dfltFontSize;
var dfltFontFamily;
var font = opts.font || {};

dfltColor = coerceAxis('color');
dfltFontColor = (dfltColor === axIn.color) ? dfltColor : font.color;
dfltFontSize = font.size;
dfltFontFamily = font.family;

handleTickValueDefaults(axIn, axOut, coerceAxis, axOut.type);
handleTickLabelDefaults(axIn, axOut, coerceAxis, axOut.type);
handleTickMarkDefaults(axIn, axOut, coerceAxis, {outerTicks: true});
handleTickLabelDefaults(axIn, axOut, coerceAxis, axOut.type, {
font: {
color: dfltFontColor,
size: dfltFontSize,
family: dfltFontFamily
}
});

var showTickLabels = coerceAxis('showticklabels');
if(showTickLabels) {
Lib.coerceFont(coerceAxis, 'tickfont', {
family: opts.font.family,
size: opts.font.size,
color: dfltFontColor
});
coerceAxis('tickangle');
coerceAxis('tickformat');
}
handleTickMarkDefaults(axIn, axOut, coerceAxis, {outerTicks: true});

handleLineGridDefaults(axIn, axOut, coerceAxis, {
dfltColor: dfltColor,
Expand All @@ -170,6 +157,18 @@ function handleDefaults(contIn, contOut, coerce, opts) {
});

coerceAxis('layer');

if(axName === 'radialaxis') {
coerceAxis('side');
coerceAxis('angle', sector[0]);

coerceAxis('title.text');
Lib.coerceFont(coerceAxis, 'title.font', {
color: dfltFontColor,
size: Lib.bigFont(dfltFontSize),
family: dfltFontFamily
});
}
}

if(axType !== 'category') coerceAxis('hoverformat');
Expand Down
Loading