-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Streamtubes [WIP] #701
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
Closed
Closed
Streamtubes [WIP] #701
Changes from 6 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
2fab4bb
initial streamtubes commit (squashed)
monfera 01bbbdd
removed original PoC code
monfera c56e5eb
removing unnecessary changes
monfera 6c7cc09
lint
monfera f7e40af
restoring test case
monfera 2035bad
adding test image
monfera cfc6a55
Rename streamtubes -> streamtube
monfera 121eb6c
stashed commit: gimbal lock (join) fix; handle non-array line color a…
monfera c180ae8
streamtube test cases
monfera 9711a59
lint
monfera a9a5123
Merge remote-tracking branch 'plotly/master' into streamtubes
monfera File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/** | ||
* Copyright 2012-2016, Plotly, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
module.exports = require('../src/traces/streamtubes'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** | ||
* Copyright 2012-2016, Plotly, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
|
||
'use strict'; | ||
|
||
var hasColorscale = require('../../components/colorscale/has_colorscale'); | ||
var colorscaleDefaults = require('../../components/colorscale/defaults'); | ||
|
||
|
||
// common to 'scatter', 'scatter3d', 'scattergeo' and 'scattergl' | ||
module.exports = function lineDefaults(traceIn, traceOut, defaultColor, layout, coerce) { | ||
|
||
var markerColor = (traceIn.marker || {}).color; | ||
|
||
coerce('line.color', defaultColor); | ||
if(hasColorscale(traceIn, 'line')) { | ||
colorscaleDefaults( | ||
traceIn, traceOut, layout, coerce, {prefix: 'line.', cLetter: 'c'} | ||
); | ||
} else { | ||
coerce('line.color', (Array.isArray(markerColor) ? false : markerColor) || | ||
defaultColor); | ||
} | ||
|
||
|
||
coerce('line.width'); | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/** | ||
* Copyright 2012-2016, Plotly, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
|
||
'use strict'; | ||
|
||
var hasColorscale = require('../../components/colorscale/has_colorscale'); | ||
var colorscaleDefaults = require('../../components/colorscale/defaults'); | ||
|
||
var subTypes = require('./subtypes'); | ||
|
||
|
||
// common to 'scatter', 'scatter3d', 'scattergeo' and 'scattergl' | ||
module.exports = function markerDefaults(traceIn, traceOut, defaultColor, layout, coerce) { | ||
var isBubble = subTypes.isBubble(traceIn), | ||
lineColor = !Array.isArray(traceIn.line) ? (traceIn.line || {}).color : undefined; | ||
|
||
if(lineColor) defaultColor = lineColor; | ||
|
||
coerce('marker.opacity', isBubble ? 0.7 : 1); | ||
coerce('marker.size'); | ||
|
||
coerce('marker.color', defaultColor); | ||
if(hasColorscale(traceIn, 'marker')) { | ||
colorscaleDefaults( | ||
traceIn, traceOut, layout, coerce, {prefix: 'marker.', cLetter: 'c'} | ||
); | ||
} | ||
|
||
if(isBubble) { | ||
coerce('marker.sizeref'); | ||
coerce('marker.sizemin'); | ||
coerce('marker.sizemode'); | ||
} | ||
|
||
return lineColor; | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
/** | ||
* Copyright 2012-2016, Plotly, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
var scatterAttrs = require('../scatter/attributes'); | ||
var colorAttributes = require('../../components/colorscale/color_attributes'); | ||
|
||
var extendFlat = require('../../lib/extend').extendFlat; | ||
|
||
var scatterLineAttrs = scatterAttrs.line, | ||
scatterMarkerAttrs = scatterAttrs.marker; | ||
|
||
function makeProjectionAttr(axLetter) { | ||
return { | ||
show: { | ||
valType: 'boolean', | ||
role: 'info', | ||
dflt: false, | ||
description: [ | ||
'Sets whether or not projections are shown along the', | ||
axLetter, 'axis.' | ||
].join(' ') | ||
}, | ||
opacity: { | ||
valType: 'number', | ||
role: 'style', | ||
min: 0, | ||
max: 1, | ||
dflt: 1, | ||
description: 'Sets the projection color.' | ||
}, | ||
scale: { | ||
valType: 'number', | ||
role: 'style', | ||
min: 0, | ||
max: 10, | ||
dflt: 2 / 3, | ||
description: [ | ||
'Sets the scale factor determining the size of the', | ||
'projection marker points.' | ||
].join(' ') | ||
} | ||
}; | ||
} | ||
|
||
module.exports = { | ||
x: { | ||
valType: 'data_array', | ||
description: 'Sets the x coordinates.' | ||
}, | ||
y: { | ||
valType: 'data_array', | ||
description: 'Sets the y coordinates.' | ||
}, | ||
z: { | ||
valType: 'data_array', | ||
description: 'Sets the z coordinates.' | ||
}, | ||
text: extendFlat({}, scatterAttrs.text, { | ||
description: [ | ||
'Sets text elements associated with each (x,y,z) triplet.', | ||
'If a single string, the same string appears over', | ||
'all the data points.', | ||
'If an array of string, the items are mapped in order to the', | ||
'this trace\'s (x,y,z) coordinates.' | ||
].join(' ') | ||
}), | ||
mode: extendFlat({}, scatterAttrs.mode, // shouldn't this be on-par with 2D? | ||
{dflt: 'lines+markers'}), | ||
projection: { | ||
x: makeProjectionAttr('x'), | ||
y: makeProjectionAttr('y'), | ||
z: makeProjectionAttr('z') | ||
}, | ||
connectgaps: scatterAttrs.connectgaps, | ||
line: extendFlat({}, { | ||
width: scatterLineAttrs.width, | ||
connectionradius: extendFlat({}, scatterMarkerAttrs.size, { | ||
dflt: 1, | ||
description: 'Sets the radius of the line connection. Either a number, or an array with as many elements as the number of points.' | ||
}), | ||
showscale: { | ||
valType: 'boolean', | ||
role: 'info', | ||
dflt: false, | ||
description: [ | ||
'Has an effect only if `line.color` is set to a numerical array.', | ||
'Determines whether or not a colorbar is displayed.' | ||
].join(' ') | ||
} | ||
}, | ||
colorAttributes('line') | ||
), | ||
marker: extendFlat({}, { | ||
size: extendFlat({}, scatterMarkerAttrs.size, {dflt: 8}), | ||
sizeref: scatterMarkerAttrs.sizeref, | ||
sizemin: scatterMarkerAttrs.sizemin, | ||
sizemode: scatterMarkerAttrs.sizemode, | ||
opacity: extendFlat({}, scatterMarkerAttrs.opacity, { | ||
arrayOk: false, | ||
description: [ | ||
'Sets the marker opacity.', | ||
'Note that the marker opacity for scatter3d traces', | ||
'must be a scalar value for performance reasons.', | ||
'To set a blending opacity value', | ||
'(i.e. which is not transparent), set *marker.color*', | ||
'to an rgba color and use its alpha channel.' | ||
].join(' ') | ||
}), | ||
showscale: scatterMarkerAttrs.showscale | ||
}, | ||
colorAttributes('marker') | ||
), | ||
textposition: extendFlat({}, scatterAttrs.textposition, {dflt: 'top center'}), | ||
textfont: scatterAttrs.textfont, | ||
_nestedModules: { | ||
'marker.colorbar': 'Colorbar' | ||
} | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/** | ||
* Copyright 2012-2016, Plotly, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
var arraysToCalcdata = require('../scatter/arrays_to_calcdata'); | ||
var calcColorscales = require('../scatter/colorscale_calc'); | ||
|
||
|
||
/** | ||
* This is a kludge to put the array attributes into | ||
* calcdata the way Scatter.plot does, so that legends and | ||
* popovers know what to do with them. | ||
*/ | ||
module.exports = function calc(gd, trace) { | ||
var cd = [{x: false, y: false, trace: trace, t: {}}]; | ||
|
||
arraysToCalcdata(cd); | ||
calcColorscales(trace); | ||
|
||
return cd; | ||
}; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
good 👀