Skip to content

Commit

Permalink
Merge pull request #4265 from plotly/streamtube-starts-length
Browse files Browse the repository at this point in the history
streamtube handle case of having starts but missing a dimension
  • Loading branch information
archmoj authored Oct 9, 2019
2 parents abbd92d + f4afbd8 commit 25fe1c9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
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

0 comments on commit 25fe1c9

Please sign in to comment.