-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Multi-axis-type sploms #2899
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
Multi-axis-type sploms #2899
Changes from 3 commits
dd563bb
9e1869d
9da5a1b
f3c73db
b3d27bd
9039a8e
ab7d9c6
39b71bb
57ddadb
15efc72
1823904
390f292
adb0004
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 |
|---|---|---|
|
|
@@ -36,19 +36,39 @@ function calc(gd, trace) { | |
| // only differ here for log axes, pass ldata to createMatrix as 'data' | ||
| var cdata = opts.cdata = []; | ||
| var ldata = opts.data = []; | ||
| var i, k, dim; | ||
| var i, k, dim, xa, ya; | ||
|
|
||
| function makeCalcdata(ax, dim) { | ||
| // call makeCalcdata with fake input | ||
| var ccol = ax.makeCalcdata({ | ||
| v: dim.values, | ||
| vcalendar: trace.calendar | ||
| }, 'v'); | ||
|
|
||
| for(var i = 0; i < ccol.length; i++) { | ||
| ccol[i] = ccol[i] === BADNUM ? NaN : ccol[i]; | ||
| } | ||
| cdata.push(ccol); | ||
| ldata.push(ax.type === 'log' ? Lib.simpleMap(ccol, ax.c2l) : ccol); | ||
| } | ||
|
|
||
| for(i = 0; i < dimensions.length; i++) { | ||
| dim = dimensions[i]; | ||
|
|
||
| if(dim.visible) { | ||
| var axId = trace._diag[i][0] || trace._diag[i][1]; | ||
| var ax = AxisIDs.getFromId(gd, axId); | ||
| if(ax) { | ||
| var ccol = makeCalcdata(ax, trace, dim); | ||
| var lcol = ax.type === 'log' ? Lib.simpleMap(ccol, ax.c2l) : ccol; | ||
| cdata.push(ccol); | ||
| ldata.push(lcol); | ||
| xa = AxisIDs.getFromId(gd, trace._diag[i][0]); | ||
| ya = AxisIDs.getFromId(gd, trace._diag[i][1]); | ||
|
|
||
| if(xa) { | ||
| makeCalcdata(xa, dim); | ||
| if(ya && ya.type === 'category') { | ||
| ya._categories = xa._categories.slice(); | ||
| } | ||
| } else if(ya) { | ||
| makeCalcdata(ya, dim); | ||
| if(xa && xa.type === 'category') { | ||
| xa._categories = ya._categories.slice(); | ||
| } | ||
|
||
| } | ||
| } | ||
| } | ||
|
|
@@ -63,8 +83,8 @@ function calc(gd, trace) { | |
| dim = dimensions[i]; | ||
|
|
||
| if(dim.visible) { | ||
| var xa = AxisIDs.getFromId(gd, trace._diag[i][0]) || {}; | ||
| var ya = AxisIDs.getFromId(gd, trace._diag[i][1]) || {}; | ||
| xa = AxisIDs.getFromId(gd, trace._diag[i][0]) || {}; | ||
| ya = AxisIDs.getFromId(gd, trace._diag[i][1]) || {}; | ||
|
|
||
| // Reuse SVG scatter axis expansion routine. | ||
| // For graphs with very large number of points and array marker.size, | ||
|
|
@@ -91,20 +111,6 @@ function calc(gd, trace) { | |
| return [{x: false, y: false, t: stash, trace: trace}]; | ||
| } | ||
|
|
||
| function makeCalcdata(ax, trace, dim) { | ||
| // call makeCalcdata with fake input | ||
| var ccol = ax.makeCalcdata({ | ||
| v: dim.values, | ||
| vcalendar: trace.calendar | ||
| }, 'v'); | ||
|
|
||
| for(var i = 0; i < ccol.length; i++) { | ||
| ccol[i] = ccol[i] === BADNUM ? NaN : ccol[i]; | ||
| } | ||
|
|
||
| return ccol; | ||
| } | ||
|
|
||
| function sceneUpdate(gd, stash) { | ||
| var scene = stash._scene; | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| { | ||
| "data": [ | ||
| { | ||
| "type": "splom", | ||
| "opacity": 0.9, | ||
| "showupperhalf": false, | ||
| "diagonal": {"visible": false }, | ||
| "dimensions": [ | ||
| { | ||
| "label": "numeric", | ||
| "values": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] | ||
| }, | ||
| { | ||
| "label": "decimal", | ||
| "values": [-3.3, 2.2, -1.1, 0, 1.1, -2.2, 3.3, 4.4, -5, 6] | ||
| }, | ||
| { | ||
| "label": "bool", | ||
| "values": [false, true, true, true, false, true, false, false, false, true] | ||
| }, | ||
| { | ||
| "label": "0/1", | ||
| "values": [0, 1, 1, 1, 1, 1, 0, 0, 0, 0] | ||
| }, | ||
| { | ||
| "label": "string", | ||
| "values": ["lyndon", "richard", "gerald", "jimmy", "ronald", "george", "bill", "georgeW", "barack", "donald"] | ||
| } | ||
| ] | ||
| } | ||
| ], | ||
| "layout": { | ||
| "hovermode": "closest", | ||
| "margin": { | ||
| "b": 80, | ||
| "l": 80, | ||
| "r": 30, | ||
| "t": 30 | ||
| }, | ||
| "yaxis2": {"type": "category"}, | ||
|
||
| "yaxis3": {"type": "category"}, | ||
| "xaxis3": {"type": "category"}, | ||
| "xaxis4": {"type": "category"} | ||
| } | ||
| } | ||
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.
Recall that
_diagis:plotly.js/src/traces/splom/defaults.js
Lines 104 to 124 in def6aa5
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.
ah ok - a little confusing as usually
xais a full axis object, an id would bexIdor something... but anyway nice fix!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.
cleaned up in -> f3c73db