Skip to content

Commit

Permalink
revise smith
Browse files Browse the repository at this point in the history
  • Loading branch information
archmoj committed Sep 29, 2021
1 parent 56e0a97 commit 60c30f4
Show file tree
Hide file tree
Showing 55 changed files with 1,561 additions and 1,880 deletions.
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
6 changes: 6 additions & 0 deletions src/plot_api/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ exports.cleanLayout = function(layout) {

var axisAttrRegex = (Plots.subplotsRegistry.cartesian || {}).attrRegex;
var polarAttrRegex = (Plots.subplotsRegistry.polar || {}).attrRegex;
var smithAttrRegex = (Plots.subplotsRegistry.smith || {}).attrRegex;
var ternaryAttrRegex = (Plots.subplotsRegistry.ternary || {}).attrRegex;
var sceneAttrRegex = (Plots.subplotsRegistry.gl3d || {}).attrRegex;

Expand Down Expand Up @@ -93,6 +94,11 @@ exports.cleanLayout = function(layout) {

var polar = layout[key];
cleanTitle(polar.radialaxis);
} else if(smithAttrRegex && smithAttrRegex.test(key)) {
// modifications for smith

var smith = layout[key];
cleanTitle(smith.realaxis);
} else if(ternaryAttrRegex && ternaryAttrRegex.test(key)) {
// modifications for ternary

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
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
9 changes: 9 additions & 0 deletions src/plots/plots.js
Original file line number Diff line number Diff line change
Expand Up @@ -2981,6 +2981,15 @@ plots.doCalcdata = function(gd, traces) {
);
}

// add smith axes to axis list
var smithIds = fullLayout._subplots.smith || [];
for(i = 0; i < smithIds.length; i++) {
axList.push(
fullLayout[smithIds[i]].realaxis,
fullLayout[smithIds[i]].imaginaryaxis
);
}

// clear relinked cmin/cmax values in shared axes to start aggregation from scratch
for(var k in fullLayout._colorAxes) {
var cOpts = fullLayout[k];
Expand Down
Loading

0 comments on commit 60c30f4

Please sign in to comment.