MCPcopy Index your code
hub / github.com/plotly/plotly.js / extractOpts

Function extractOpts

src/components/colorscale/helpers.js:59–100  ·  view source on GitHub ↗

* Extract 'c' / 'z', trace / color axis colorscale options * * Note that it would be nice to replace all z* with c* equivalents in v3 * * @param {object} cont : attribute container * @return {object}: * - min: cmin or zmin * - max: cmax or zmax * - mid: cmid or zmid * - auto: cauto or z

(cont)

Source from the content-addressed store, hash-verified

57 * - _sync: function syncing attr and underscore dual (useful when calc'ing min/max)
58 */
59function extractOpts(cont) {
60 var colorAx = cont._colorAx;
61 var cont2 = colorAx ? colorAx : cont;
62 var out = {};
63 var cLetter;
64 var i, k;
65
66 for(i = 0; i < constantAttrs.length; i++) {
67 k = constantAttrs[i];
68 out[k] = cont2[k];
69 }
70
71 if(colorAx) {
72 cLetter = 'c';
73 for(i = 0; i < letterAttrs.length; i++) {
74 k = letterAttrs[i];
75 out[k] = cont2['c' + k];
76 }
77 } else {
78 var k2;
79 for(i = 0; i < letterAttrs.length; i++) {
80 k = letterAttrs[i];
81 k2 = 'c' + k;
82 if(k2 in cont2) {
83 out[k] = cont2[k2];
84 continue;
85 }
86 k2 = 'z' + k;
87 if(k2 in cont2) {
88 out[k] = cont2[k2];
89 }
90 }
91 cLetter = k2.charAt(0);
92 }
93
94 out._sync = function(k, v) {
95 var k2 = letterAttrs.indexOf(k) !== -1 ? cLetter + k : k;
96 cont2[k2] = cont2['_' + k2] = v;
97 };
98
99 return out;
100}
101
102/**
103 * Extract colorscale into numeric domain and color range.

Callers 14

styleLinesFunction · 0.85
styleBarLikeFunction · 0.85
styleSpatialFunction · 0.85
relinkColorAttrsFunction · 0.85
calc.jsFile · 0.85
extractScaleFunction · 0.85
plot.jsFile · 0.85
hover.jsFile · 0.85
convert.jsFile · 0.85
convert.jsFile · 0.85
convertFunction · 0.85
convert.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…