Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Add "raw" sizemode to cone trace #6938

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 9 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
add vector sizemode option to cone
  • Loading branch information
archmoj committed Mar 20, 2024
commit 0ae9c7fbc2fe0364b4f0ff28c7bcc02aa4612847
6 changes: 4 additions & 2 deletions 6 src/traces/cone/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,14 @@ var attrs = {

sizemode: {
valType: 'enumerated',
values: ['scaled', 'absolute'],
values: ['scaled', 'absolute', 'vector'],
archmoj marked this conversation as resolved.
Show resolved Hide resolved
editType: 'calc',
dflt: 'scaled',
description: [
'Determines whether `sizeref` is set as a *scaled* (i.e unitless) scalar',
'(normalized by the max u/v/w norm in the vector field) or as',
'*absolute* value (in the same units as the vector field).'
'*absolute* value (in the same units as the vector field).',
'To display sizes in actual vector scale use *vector*.'
].join(' ')
},
sizeref: {
Expand All @@ -115,6 +116,7 @@ var attrs = {
'This factor (computed internally) corresponds to the minimum "time" to travel across',
'two successive x/y/z positions at the average velocity of those two successive positions.',
'All cones in a given trace use the same factor.',
'With `sizemode` set to *vector*, its default value is *1*',
'With `sizemode` set to *scaled*, `sizeref` is unitless, its default value is *0.5*',
'With `sizemode` set to *absolute*, `sizeref` has the same units as the u/v/w vector field,',
'its the default value is half the sample\'s maximum vector norm.'
Expand Down
9 changes: 7 additions & 2 deletions 9 src/traces/cone/convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,20 @@ function convert(scene, trace) {
coneOpts.vertexIntensityBounds = [cOpts.min / trace._normMax, cOpts.max / trace._normMax];
coneOpts.coneOffset = anchor2coneOffset[trace.anchor];

if(trace.sizemode === 'scaled') {

var sizemode = trace.sizemode;
if(sizemode === 'scaled') {
// unitless sizeref
coneOpts.coneSize = trace.sizeref || 0.5;
} else {
} else if(sizemode === 'absolute') {
// sizeref here has unit of velocity
coneOpts.coneSize = trace.sizeref && trace._normMax ?
trace.sizeref / trace._normMax :
0.5;
} else if(sizemode === 'vector') {
coneOpts.coneSize = trace.sizeref;
}
coneOpts.coneSizemode = sizemode;

var meshData = conePlot(coneOpts);

Expand Down
4 changes: 2 additions & 2 deletions 4 src/traces/cone/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
return;
}

coerce('sizeref');
coerce('sizemode');
var sizemode = coerce('sizemode');
coerce('sizeref', sizemode === 'vector' ? 1 : 0.5);

coerce('anchor');

Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.