MCPcopy Create free account
hub / github.com/plotly/plotly.js / unitToColorScale

Function unitToColorScale

src/traces/parcoords/parcoords.js:118–140  ·  view source on GitHub ↗
(cscale)

Source from the content-addressed store, hash-verified

116}
117
118function unitToColorScale(cscale) {
119 var colorStops = cscale.map(function(d) { return d[0]; });
120 var colorTuples = cscale.map(function(d) {
121 var RGBA = rgba(d[1]);
122 return d3.rgb('rgb(' + RGBA[0] + ',' + RGBA[1] + ',' + RGBA[2] + ')');
123 });
124 var prop = function(n) { return function(o) { return o[n]; }; };
125
126 // We can't use d3 color interpolation as we may have non-uniform color palette raster
127 // (various color stop distances).
128 var polylinearUnitScales = 'rgb'.split('').map(function(key) {
129 return d3.scale.linear()
130 .clamp(true)
131 .domain(colorStops)
132 .range(colorTuples.map(prop(key)));
133 });
134
135 return function(d) {
136 return polylinearUnitScales.map(function(s) {
137 return s(d);
138 });
139 };
140}
141
142function someFiltersActive(view) {
143 return view.dimensions.some(function(p) {

Callers 1

modelFunction · 0.85

Calls 1

propFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…