(scl, dflt)
| 136 | var defaultScale = scales.RdBu; |
| 137 | |
| 138 | function getScale(scl, dflt) { |
| 139 | if(!dflt) dflt = defaultScale; |
| 140 | if(!scl) return dflt; |
| 141 | |
| 142 | function parseScale() { |
| 143 | try { |
| 144 | scl = scales[scl] || JSON.parse(scl); |
| 145 | } catch(e) { |
| 146 | scl = dflt; |
| 147 | } |
| 148 | } |
| 149 | |
| 150 | if(typeof scl === 'string') { |
| 151 | parseScale(); |
| 152 | // occasionally scl is double-JSON encoded... |
| 153 | if(typeof scl === 'string') parseScale(); |
| 154 | } |
| 155 | |
| 156 | if(!isValidScaleArray(scl)) return dflt; |
| 157 | return scl; |
| 158 | } |
| 159 | |
| 160 | |
| 161 | function isValidScaleArray(scl) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…