Skip to content

Carpet plot rebase #1595

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

Merged
merged 23 commits into from
Apr 17, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
eee837f
Add ensure array lib function to allocate/resize
rreusser Apr 13, 2017
5a0b788
Add axis cartesian axis visibility option
rreusser Apr 13, 2017
89e095e
Add measureText function to drawing
rreusser Apr 13, 2017
e1a0417
Tweak showscale to allow unset (instead of strictly false)
rreusser Apr 13, 2017
620cd43
Contour plot lines to use non-scaling stroke
rreusser Apr 13, 2017
728a6f4
Genericize heatmap xyz variable names
rreusser Apr 13, 2017
c2994e7
More carefully track legend trace isolation indices
rreusser Apr 13, 2017
fe9850c
Add optional overrides to contour handleStyleDefaults
rreusser Apr 13, 2017
d1f2258
Genericize tolerances in find_all_paths to make way for carpet
rreusser Apr 13, 2017
4bcf438
Add flag to disable scatter marker culling (needed for carpet)
rreusser Apr 13, 2017
6b896d8
Tweak contour colorscale logic since carpet may set infinities
rreusser Apr 13, 2017
b8c71e1
Add group to plot
rreusser Apr 13, 2017
e4971ef
Carpet plots
rreusser Apr 13, 2017
c98553a
make rreusser's carpet tests pass
etpinard Apr 13, 2017
71b96f3
add a few carpet interaction tests
etpinard Apr 13, 2017
bc1c5c8
:hocho: arraytools dep (sorry @bpostlethwaite)
etpinard Apr 14, 2017
9c76d7a
exit early in axis defaults when visible is false
etpinard Apr 14, 2017
85d6b8a
add axis `visible: false` mock
etpinard Apr 14, 2017
54f092d
implement axis visible in 3D
etpinard Apr 14, 2017
d9cb011
add 3d axis `visible: false` mock
etpinard Apr 14, 2017
f1e8aee
Merge pull request #1596 from plotly/carpet-test-etienne
etpinard Apr 17, 2017
bc0f890
extendFlat -> slice
etpinard Apr 17, 2017
c2a7092
Merge pull request #1599 from plotly/axis-visible-3d
etpinard Apr 17, 2017
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
2 changes: 2 additions & 0 deletions src/plots/cartesian/axes.js
Original file line number Diff line number Diff line change
Expand Up @@ -1665,6 +1665,8 @@ axes.doTicks = function(gd, axid, skipTitle) {
ticksign = ticksign.map(function(v) { return -v; });
}

if(!ax.visible) return;

// remove zero lines, grid lines, and inside ticks if they're within
// 1 pixel of the end
// The key case here is removing zero lines when the axis bound is zero.
Expand Down
2 changes: 2 additions & 0 deletions src/plots/cartesian/axis_defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce,
return Lib.coerce2(containerIn, containerOut, layoutAttributes, attr, dflt);
}

coerce('visible', !options.cheateronly);

var axType = containerOut.type;

if(axType === 'date') {
Expand Down
9 changes: 9 additions & 0 deletions src/plots/cartesian/layout_attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ var constants = require('./constants');


module.exports = {
visible: {
valType: 'boolean',
role: 'info',
description: [
'A single toggle to hide the axis while preserving interaction like dragging.',
'Default is true when a cheater plot is present on the axis, otherwise',
'false'
].join(' ')
},
color: {
valType: 'color',
dflt: colorAttrs.defaultLine,
Expand Down
20 changes: 19 additions & 1 deletion src/plots/cartesian/layout_defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {
yaListCartesian = [],
xaListGl2d = [],
yaListGl2d = [],
xaListCheater = [],
xaListNonCheater = [],
outerTicks = {},
noGrids = {},
i;
Expand All @@ -51,6 +53,21 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {
var xaName = axisIds.id2name(trace.xaxis),
yaName = axisIds.id2name(trace.yaxis);

// Two things trigger axis visibility:
// 1. is not carpet
// 2. carpet that's not cheater
if(!Registry.traceIs(trace, 'carpet') || (trace.type === 'carpet' && !trace._cheater)) {
if(xaName) Lib.pushUnique(xaListNonCheater, xaName);
}

// The above check for definitely-not-cheater is not adequate. This
// second list tracks which axes *could* be a cheater so that the
// full condition triggering hiding is:
// *could* be a cheater and *is not definitely visible*
if(trace.type === 'carpet' && trace._cheater) {
if(xaName) Lib.pushUnique(xaListCheater, xaName);
}

// add axes implied by traces
if(xaName && listX.indexOf(xaName) === -1) listX.push(xaName);
if(yaName && listY.indexOf(yaName) === -1) listY.push(yaName);
Expand Down Expand Up @@ -168,7 +185,8 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {
showGrid: !noGrids[axName],
data: fullData,
bgColor: bgColor,
calendar: layoutOut.calendar
calendar: layoutOut.calendar,
cheateronly: axLetter === 'x' && (xaListCheater.indexOf(axName) !== -1 && xaListNonCheater.indexOf(axName) === -1)
};

handleAxisDefaults(axLayoutIn, axLayoutOut, coerce, defaultOptions, layoutOut);
Expand Down
1 change: 1 addition & 0 deletions src/plots/gl3d/layout/axis_attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ var extendFlat = require('../../../lib/extend').extendFlat;


module.exports = {
visible: axesAttrs.visible,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

visible for 3D axes doesn't actually works, correct?

I think you had to put it in there so that supplyDefaults doesn't error out.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, correct. Was contemplating the best option as was working back through that. Correct though, it was just to make them not fail.

Copy link
Contributor Author

@rreusser rreusser Apr 13, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps the right answer is not to remove the attribute and avoid supplying that default in that case.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

scene.?axis.visible: false would be a nice option too. So I don't think it's worth changing the logic. Opening a new issue about implementing ?axis.visible in 3D will suffice.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done in #1599

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh wow, nice!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#1599 is now merged in this PR.

showspikes: {
valType: 'boolean',
role: 'info',
Expand Down
3 changes: 3 additions & 0 deletions src/plots/ternary/ternary.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ proto.adjustLayout = function(ternaryLayout, graphSize) {
// fictitious angles and domain, but then rotate and translate
// it into place at the end
var aaxis = _this.aaxis = extendFlat({}, ternaryLayout.aaxis, {
visible: true,
range: [amin, sum - bmin - cmin],
side: 'left',
_counterangle: 30,
Expand All @@ -220,6 +221,7 @@ proto.adjustLayout = function(ternaryLayout, graphSize) {
// baxis goes across the bottom (backward). We can set it up as an x axis
// without any enclosing transformation.
var baxis = _this.baxis = extendFlat({}, ternaryLayout.baxis, {
visible: true,
range: [sum - amin - cmin, bmin],
side: 'bottom',
_counterangle: 30,
Expand All @@ -239,6 +241,7 @@ proto.adjustLayout = function(ternaryLayout, graphSize) {
// caxis goes down the right side. Set it up as a y axis, with
// post-transformation similar to aaxis
var caxis = _this.caxis = extendFlat({}, ternaryLayout.caxis, {
visible: true,
range: [sum - amin - bmin, cmin],
side: 'right',
_counterangle: 30,
Expand Down