* 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)
| 57 | * - _sync: function syncing attr and underscore dual (useful when calc'ing min/max) |
| 58 | */ |
| 59 | function 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. |
no outgoing calls
no test coverage detected
searching dependent graphs…