10 examples of 'd3 scaletime' in JavaScript

Every line of 'd3 scaletime' 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
12function scale(x) {
13 return range[bisect(domain, x, 0, n)]
14}
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

253function getScaleOrdinalRange(d3, range) {
254 return d3.scale.ordinal()
255 .range(range);
256}
130function timeline(dateDomain,time,step) {
131 var intervals= d3.time[time].range(new Date(dateDomain[0]), new Date(dateDomain[1]),step);
132 intervals.unshift(dateDomain[0])
133return intervals
134}
219export function createScaleY(type, domain = [], y = 0) {
220 switch (type) {
221 case 'time':
222 return createScaleTimeY(domain, y);
223 case 'text':
224 return createScaleTextY(domain, y);
225 default:
226 return createScaleLinearY(domain, y);
227 }
228}
80function scaleY(d) {
81 var y = d.y != null ? d.y : d;
82 y = d3.scaleLinear()
83 .domain([minY, maxY])
84 .interpolate(d3.interpolateNumber)
85 .range([bound, (height - seriesHeight) - bound])(y);
86 return Math.min(Math.max(y, d.group), height - d.group);
87}
81getYScale() {
82 return d3.scale
83 .linear()
84 .range([this.height, 0])
85 .domain([this.yMin, this.yMax]);
86}
5export function timeScale([domain, range], hash) {
6 let scale = scaleTime();
7 addOptionsToScale(scale, domain, range, hash);
8 return scale;
9}
10function time_value(d) {
11 if (d.weights)
12 return d.weights.time;
13 else
14 return d3.sum(d.values, time_value);
15}
11function scale(d) {
12 var key = d + "", i = index.get(key);
13 if (!i) {
14 if (unknown !== implicit) return unknown;
15 index.set(key, i = domain.push(d));
16 }
17 return range[(i - 1) % range.length];
18}
366getXScaleLine(domain, width): any {
367 let scale;
368 if (this.bandwidth === undefined) {
369 this.bandwidth = (this.dims.width - this.barPadding);
370 }
371
372 if (this.scaleType === 'time') {
373 scale = scaleTime()
374 .range([0, width])
375 .domain(domain);
376 } else if (this.scaleType === 'linear') {
377 scale = scaleLinear()
378 .range([0, width])
379 .domain(domain);
380
381 if (this.roundDomains) {
382 scale = scale.nice();
383 }
384 } else if (this.scaleType === 'ordinal') {
385 scale = scalePoint()
386 .range([this.bandwidth / 2, width - this.bandwidth / 2])
387 .domain(domain);
388 }
389
390 return scale;
391}

Related snippets