10 examples of 'd3 rangeround' in JavaScript

Every line of 'd3 rangeround' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
253function getScaleOrdinalRange(d3, range) {
254 return d3.scale.ordinal()
255 .range(range);
256}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

179function roundWithLine(v) {
180 // if there are explicit gaps, don't round,
181 // it can make the gaps look crappy
182 return (opts.gap === 0 && opts.groupgap === 0) ?
183 d3.round(Math.round(v) - offset, 2) : v;
184}
20function d3_range_integerScale(x) {
21 var k = 1;
22 while (x * k % 1) k *= 10;
23 return k;
24}
28function d3_scaleRange(scale) {
29 return scale.rangeExtent ? scale.rangeExtent() : d3_scaleExtent(scale.range());
30}
53function roundToStep(rawRangeVal, step, rangeMin, roundFn){
54 roundFn = (roundFn) ? roundFn : Math.round;
55 rangeMin = (isNum(rangeMin)) ? rangeMin : 0;
56
57 if(!isNum(rawRangeVal)){
58 throw "invalid value " + rawRangeVal;
59 }
60 if((!isNum(step)) || +step <= 0){
61 throw "invalid step "+step;
62 }
63 return roundFn((rawRangeVal - rangeMin) / step) * step + rangeMin;
64}
313getRScale (domain, range): any {
314 const scale = scaleLinear()
315 .range(range)
316 .domain(domain);
317
318 return this.roundDomains ? scale.nice() : scale;
319}
5function d3_scale_quantize(x0, x1, range) {
6 var kx, i;
7
8 function scale(x) {
9 return range[Math.max(0, Math.min(i, Math.floor(kx * (x - x0))))];
10 }
11
12 function rescale() {
13 kx = range.length / (x1 - x0);
14 i = range.length - 1;
15 return scale;
16 }
17
18 scale.domain = function(x) {
19 if (!arguments.length) return [x0, x1];
20 x0 = +x[0];
21 x1 = +x[x.length - 1];
22 return rescale();
23 };
24
25 scale.range = function(x) {
26 if (!arguments.length) return range;
27 range = x;
28 return rescale();
29 };
30
31 scale.copy = function() {
32 return d3_scale_quantize(x0, x1, range); // copy on write
33 };
34
35 return rescale();
36}
12function scale(x) {
13 return range[bisect(domain, x, 0, n)]
14}
101function reverseRange(scale) {
102 // reverse ranges in place
103 let revRange;
104 if (that.shrinkIntronsState) {
105 revRange = that.brokenRange;
106 } else {
107 revRange = scale.range().slice(0);
108 revRange.reverse();
109 }
110 scale.range(revRange);
111}
78function getScale(extent, breaks, values) {
79 if (metricConfig[model.metricId].scale) {
80 extent = _.clone(metricConfig[model.metricId].scale);
81 extent.push(x_extent[1]);
82 extent.unshift(x_extent[0]);
83 }
84 else if (quantileScale === "jenks") {
85 extent = jenks(values, colorbreaks - 1);
86 }
87 return d3.scale.quantile()
88 .domain(extent)
89 .range(d3.range(breaks).map(function (i) {
90 return "q" + i;
91 }));
92}

Related snippets