Spaces:
Paused
Paused
Download node_modules/@plotly/d3/src/scale/quantize.js from Leon4gr45/UserSyncFrontend: direct link, hf CLI and curl.
- Browser
- Download file 869 Bytes
-
https://huggingface.co/spaces/Leon4gr45/UserSyncFrontend/resolve/main/node_modules/%40plotly/d3/src/scale/quantize.js
- Command line
-
hf download hf://spaces/Leon4gr45/UserSyncFrontend/node_modules/@plotly/d3/src/scale/quantize.js
-
curl -L -o quantize.js https://huggingface.co/spaces/Leon4gr45/UserSyncFrontend/resolve/main/node_modules/%40plotly/d3/src/scale/quantize.js
869 Bytes
| import "scale"; | |
| d3.scale.quantize = function() { | |
| return d3_scale_quantize(0, 1, [0, 1]); | |
| }; | |
| function d3_scale_quantize(x0, x1, range) { | |
| var kx, i; | |
| function scale(x) { | |
| return range[Math.max(0, Math.min(i, Math.floor(kx * (x - x0))))]; | |
| } | |
| function rescale() { | |
| kx = range.length / (x1 - x0); | |
| i = range.length - 1; | |
| return scale; | |
| } | |
| scale.domain = function(x) { | |
| if (!arguments.length) return [x0, x1]; | |
| x0 = +x[0]; | |
| x1 = +x[x.length - 1]; | |
| return rescale(); | |
| }; | |
| scale.range = function(x) { | |
| if (!arguments.length) return range; | |
| range = x; | |
| return rescale(); | |
| }; | |
| scale.invertExtent = function(y) { | |
| y = range.indexOf(y); | |
| y = y < 0 ? NaN : y / kx + x0; | |
| return [y, y + 1 / kx]; | |
| }; | |
| scale.copy = function() { | |
| return d3_scale_quantize(x0, x1, range); // copy on write | |
| }; | |
| return rescale(); | |
| } | |