-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Faster axis autorange + remove calcIfAutorange edit type #2823
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
Changes from 6 commits
9c2be8d
c9711dc
bd61c54
b1911b3
35d501d
a8fb653
6e19c6e
4e8ff28
c75cda8
8f23ef5
a326778
138a84f
1c40947
026cd53
1cdc36b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -96,8 +96,9 @@ function calcAxisExpansion(gd, trace, xa, ya, x, y, ppad) { | |
yOptions.padded = false; | ||
} | ||
|
||
Axes.expand(xa, x, xOptions); | ||
Axes.expand(ya, y, yOptions); | ||
// N.B. asymmetric splom traces call this with undefined xa or ya | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good catch -> 026cd53 |
||
if(xa._id) Axes.expand(xa, x, xOptions); | ||
if(ya._id) Axes.expand(ya, y, yOptions); | ||
} | ||
|
||
function calcMarkerSize(trace, serieslen) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -737,6 +737,43 @@ describe('annotations autorange', function() { | |
.catch(failTest) | ||
.then(done); | ||
}); | ||
|
||
it('should propagate axis autorange changes when axis ranges are set', function(done) { | ||
function _assert(msg, xrng, yrng) { | ||
var fullLayout = gd._fullLayout; | ||
expect(fullLayout.xaxis.range).toBeCloseToArray(xrng, 1, msg + ' xrng'); | ||
expect(fullLayout.yaxis.range).toBeCloseToArray(yrng, 1, msg + ' yrng'); | ||
} | ||
|
||
Plotly.plot(gd, [{y: [1, 2]}], { | ||
xaxis: {range: [0, 2]}, | ||
yaxis: {range: [0, 2]}, | ||
annotations: [{ | ||
text: 'a', | ||
x: 3, y: 3 | ||
}] | ||
}) | ||
.then(function() { | ||
_assert('set rng / small tx', [0, 2], [0, 2]); | ||
return Plotly.relayout(gd, 'annotations[0].text', 'loooooooooooooooooooooooong'); | ||
}) | ||
.then(function() { | ||
_assert('set rng / big tx', [0, 2], [0, 2]); | ||
return Plotly.relayout(gd, { | ||
'xaxis.autorange': true, | ||
'yaxis.autorange': true | ||
}); | ||
}) | ||
.then(function() { | ||
_assert('auto rng / big tx', [-0.22, 3.57], [0.84, 3.365]); | ||
return Plotly.relayout(gd, 'annotations[0].text', 'a'); | ||
}) | ||
.then(function() { | ||
_assert('auto rng / small tx', [-0.18, 3.035], [0.84, 3.365]); | ||
}) | ||
.catch(failTest) | ||
.then(done); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Beautiful test! |
||
}); | ||
}); | ||
|
||
describe('annotation clicktoshow', function() { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not for now of course, but annotations (showing, hiding, dragging in GUI) are a great argument in favor of each trace and item tracking its own autorange contributions, so it doesn't take a full recalc to move one annotation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Absolutely! I'll open an issue about this once this PR is merged.