-
-
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
Streamtubes [WIP] #701
Changes from all commits
2fab4bb
01bbbdd
c56e5eb
6c7cc09
f7e40af
2035bad
cfc6a55
121eb6c
c180ae8
9711a59
a9a5123
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 |
---|---|---|
@@ -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/streamtube'); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/** | ||
* 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); | ||
} | ||
}; |
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; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
/** | ||
* 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 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') | ||
}, | ||
sizingaxis: { | ||
valType: 'enumerated', | ||
role: 'info', | ||
values: [0, 1, 2], | ||
dflt: 0, | ||
description: [ | ||
'Specifies the axis index in relation to which the `line.width` and `marker.size` values are determined. The', | ||
'default value is `0`, which specifies the `x` axis, i.e. sizes will be determined as a multiple of one unit', | ||
'on the `x` axis. `0`, `1`, `2` refer to `x`, `y`, `z`, respectively.' | ||
].join(' ') | ||
}, | ||
connectgaps: scatterAttrs.connectgaps, | ||
line: extendFlat({}, { | ||
connectiondiameter: 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.' | ||
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. 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. Yes. In this case, the light reflection can be more of a distraction than a positive. So with this type of use, it's good to avoid using a specular light component. |
||
}), | ||
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: { | ||
valType: 'number', | ||
min: 0, | ||
dflt: 1, | ||
arrayOk: true, | ||
role: 'style', | ||
description: 'Sets the marker radius, in units of `sizingaxis`. May be a number or an array of numbers.' | ||
}, | ||
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' | ||
} | ||
}; |
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; | ||
}; |
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 👀