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

Function getScale

src/components/colorscale/scales.js:138–158  ·  view source on GitHub ↗
(scl, dflt)

Source from the content-addressed store, hash-verified

136var defaultScale = scales.RdBu;
137
138function 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
161function isValidScaleArray(scl) {

Callers

nothing calls this directly

Calls 2

parseScaleFunction · 0.85
isValidScaleArrayFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…