-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
initial streamtubes commit (squashed)
- Loading branch information
Showing
18 changed files
with
2,067 additions
and
43 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 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 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 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.