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

streamtube handle case of having starts but missing a dimension #4265

Merged
merged 2 commits into from
Oct 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions src/traces/streamtube/convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ function convert(scene, trace) {

tubeOpts.meshgrid = [meshx, meshy, meshz];

if(trace.starts) {
var slen = trace._slen;
var slen = trace._slen;
if(slen) {
tubeOpts.startingPositions = zip3(
toDataCoords(trace.starts.x.slice(0, slen), 'xaxis'),
toDataCoords(trace.starts.y.slice(0, slen), 'yaxis'),
Expand Down
18 changes: 18 additions & 0 deletions test/jasmine/tests/streamtube_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,24 @@ describe('Test streamtube starting positions defaults:', function() {
expect(exp.cellsLength).toBe(obj.cells.length, 'cells length');
}

it('@gl should ignore starts if one (x | y | z) dimension missing', function(done) {
var mock = makeFigure(4, 4, 4);
mock.data[0].starts = {
x: [0, 1, 2, 3],
// missing y
z: [0, 1, 2, 3]
};

Plotly.plot(gd, mock).then(function() {
_assert({
positionsLength: 6144,
cellsLength: 2048
});
})
.catch(failTest)
.then(done);
});

it('@gl should cut xz at min-y and take all x/y/z pts on that plane except those on the edges', function(done) {
Plotly.plot(gd, makeFigure(3, 3, 3)).then(function() {
_assert({
Expand Down