Skip to content

Implement connectGaps #361

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 8 commits into from
Apr 1, 2016
Merged
Show file tree
Hide file tree
Changes from 3 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
2 changes: 2 additions & 0 deletions devtools/test_dashboard/test_gl3d.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ plots['marker-arrays'] = require('@mocks/gl3d_marker-arrays.json');
plots['scatter3d-colorscale'] = require('@mocks/gl3d_scatter3d-colorscale.json');
plots['autocolorscale'] = require('@mocks/gl3d_autocolorscale.json');
plots['nan-holes'] = require('@mocks/gl3d_nan-holes.json');
plots['connectgaps'] = require('@mocks/gl3d_scatter3d-connectgaps.json');
plots['tet'] = require('@mocks/gl3d_tet.json');
plots['surface_intensity'] = require('@mocks/gl3d_surface_intensity.json');
plots['connectgaps'] = require('@mocks/gl3d_scatter3d-connectgaps.json');
Copy link
Contributor

Choose a reason for hiding this comment

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

duplicate.

Copy link
Contributor

Choose a reason for hiding this comment

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

and this line should be:

plots['scatter3d-connectgaps'] = require('@mocks/gl3d_scatter3d-connectgaps.json');

so that the corresponding image baseline is displayed properly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

whoops! that screwed up when I rebased


plotButtons(plots, figDir);
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"gl-error2d": "^1.0.0",
"gl-error3d": "^1.0.0",
"gl-line2d": "^1.2.1",
"gl-line3d": "^1.0.1",
"gl-line3d": "^1.1.0",
"gl-mat4": "^1.1.2",
"gl-mesh3d": "^1.0.7",
"gl-plot2d": "^1.1.6",
Expand Down
6 changes: 6 additions & 0 deletions src/traces/scatter3d/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ module.exports = {
y: makeProjectionAttr('y'),
z: makeProjectionAttr('z')
},
connectgaps: {
Copy link
Contributor

Choose a reason for hiding this comment

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

let's use the value object from scatter/attributes.js:

connectgaps: scatterAttrs.connectgaps,

valType: 'boolean',
role: 'style',
dfl: false,
description: 'Connects gaps in data'
},
line: {
color: scatterLineAttrs.color,
width: scatterLineAttrs.width,
Expand Down
3 changes: 2 additions & 1 deletion src/traces/scatter3d/convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,8 @@ proto.update = function(data) {
lineWidth: options.lineWidth || 1,
dashes: dashPattern[0],
dashScale: dashPattern[1],
opacity: data.opacity
opacity: data.opacity,
connectGaps: data.connectgaps
};

if(this.mode.indexOf('lines') !== -1) {
Expand Down
1 change: 1 addition & 0 deletions src/traces/scatter3d/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout

coerce('text');
coerce('mode');
coerce('connectgaps');
Copy link
Contributor

Choose a reason for hiding this comment

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

This coerce call should be in the hasLines block below this line - as connectgaps only makes sense for traces with mode 'lines'.


if(subTypes.hasLines(traceOut)) {
handleLineDefaults(traceIn, traceOut, defaultColor, coerce);
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions test/image/mocks/gl3d_scatter3d-connectgaps.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"data": [{
"type": "scatter3d",
"mode": "lines",
"x": [0, 1, 2, 3, 4, 5],
"y": [0, 1, 2, 3, 4, 5],
"z": [2, 1, null, null, 0, 3],
"connectgaps": false
}],
"layout": {
"title": "connect gaps test"
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's check that gaps in x and y also work as expected using:

{
  "data": [{
    "type": "scatter3d",
    "mode": "lines",
    "x": [0, 0, null, null, 0, 0],
    "y": [0, 1, 2, 3, 4, 5],
    "z": [2, 1, null, null, 0, 3],
    "connectgaps": false,
    "name": "gap in z"
  }, {
    "type": "scatter3d",
    "mode": "lines",
    "x": [1, 1, 1, 1, 1, 1],
    "y": [0, 1, null, null, 4, 5],
    "z": [2, 1, 2, 0, 0, 3],
    "connectgaps": false,
    "name": "gap in y"
  },{
    "type": "scatter3d",
    "mode": "lines",
    "x": [2, 2, null, null, 2, 2],
    "y": [0, 1, 2, 3, 4, 5],
    "z": [2, 1, 2, 0, 0, 3],
    "connectgaps": false,
    "name": "gap in x"
  }],
  "layout": {
    "title": "connect gaps test",
  }
}

}
}