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

Function hasColorscale

src/components/colorscale/helpers.js:12–39  ·  view source on GitHub ↗
(trace, containerStr, colorKey)

Source from the content-addressed store, hash-verified

10var isValidScale = require('./scales').isValid;
11
12function hasColorscale(trace, containerStr, colorKey) {
13 var container = containerStr ?
14 Lib.nestedProperty(trace, containerStr).get() || {} :
15 trace;
16
17 var color = container[colorKey || 'color'];
18 if(color && color._inputArray) color = color._inputArray;
19
20 var isArrayWithOneNumber = false;
21 if(Lib.isArrayOrTypedArray(color)) {
22 for(var i = 0; i < color.length; i++) {
23 if(isNumeric(color[i])) {
24 isArrayWithOneNumber = true;
25 break;
26 }
27 }
28 }
29
30 return (
31 Lib.isPlainObject(container) && (
32 isArrayWithOneNumber ||
33 container.showscale === true ||
34 (isNumeric(container.cmin) && isNumeric(container.cmax)) ||
35 isValidScale(container.colorscale) ||
36 Lib.isPlainObject(container.colorbar)
37 )
38 );
39}
40
41var constantAttrs = ['showscale', 'autocolorscale', 'colorscale', 'reversescale', 'colorbar'];
42var letterAttrs = ['min', 'max', 'mid', 'auto'];

Callers 15

colorscale_test.jsFile · 0.85
handleLineDefaultsFunction · 0.85
calc.jsFile · 0.85
defaults.jsFile · 0.85
defaults.jsFile · 0.85
colorscale_calc.jsFile · 0.85
line_defaults.jsFile · 0.85
marker_defaults.jsFile · 0.85
handleLineDefaultsFunction · 0.85
style_defaults.jsFile · 0.85
calc.jsFile · 0.85

Calls 1

isValidScaleFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…