本文整理汇总了TypeScript中d3-array.range函数的典型用法代码示例。如果您正苦于以下问题:TypeScript range函数的具体用法?TypeScript range怎么用?TypeScript range使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了range函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: generateColorScheme
generateColorScheme(scheme, type, domain) {
if (typeof(scheme) === 'string') {
scheme = colorSets.find(cs => {
return cs.name === scheme;
});
}
let colorScale;
if (type === 'quantile') {
colorScale = scaleQuantile()
.range(scheme.domain)
.domain(domain);
} else if (type === 'ordinal') {
colorScale = scaleOrdinal()
.range(scheme.domain)
.domain(domain);
} else if (type === 'linear') {
// linear schemes must have at least 2 colors
const colorDomain = [...scheme.domain];
if (colorDomain.length === 1) {
colorDomain.push(colorDomain[0]);
this.colorDomain = colorDomain;
}
const points = range(0, 1, 1.0 / colorDomain.length);
colorScale = scaleLinear()
.domain(points)
.range(colorDomain);
}
return colorScale;
}
开发者ID:emilkpetkov,项目名称:ngx-charts,代码行数:33,代码来源:color.helper.ts
示例2: Date
mergedArray = d3Array.permute(readonlyMergedArray, [1, 0, 2, 5, 3, 4, 6]);
// Getting an ordered array with object properties
const testObject = {
val: 10,
name: 'Test',
when: new Date(),
more: [10, 30, 40]
};
const x: Array<number | string | Date | number[]> = d3Array.permute(testObject, ['name', 'val', 'when', 'more']);
// range() ---------------------------------------------------------------------
numbersArray = d3Array.range(10);
numbersArray = d3Array.range(1, 10);
numbersArray = d3Array.range(1, 10, 0.5);
// shuffle() -------------------------------------------------------------------
mergedArray = d3Array.shuffle(mergedArray);
mergedArray = d3Array.shuffle(mergedArray, 1);
mergedArray = d3Array.shuffle(mergedArray, 1, 3);
// $ExpectError
mergedArray = d3Array.shuffle(readonlyMergedArray); // fails, shuffle mutates input array in-place
// Test each TypedArray explicitly. Can't use ArrayLike in this case because shuffle is mutable and ArrayLike would include ReadonlyArray
const resultInt8: Int8Array = d3Array.shuffle(new Int8Array(numbersArray));
const resultUint8: Uint8Array = d3Array.shuffle(new Uint8Array(numbersArray));
const resultUint8Clamped: Uint8ClampedArray = d3Array.shuffle(new Uint8ClampedArray(numbersArray));
开发者ID:itslenny,项目名称:DefinitelyTyped,代码行数:31,代码来源:d3-array-tests.ts
示例3: range
size = contGen.size();
// smooth(...) -----------------------------------------------------------------
// set with chainability
contGen = contGen.smooth(true);
boolFlag = contGen.smooth();
// thresholds(...) -------------------------------------------------------------
// set with count
contGen = contGen.thresholds(10);
// set with array
const thresholds1 = range(1, 21)
.map(p => Math.pow(2, p));
contGen = contGen.thresholds(thresholds1);
// set with threshold array generator
contGen = contGen.thresholds(thresholdArrayGen); // mock
// set with threshold count generator
contGen = contGen.thresholds(thresholdSturges);
// get
thresholdGenerator = contGen.thresholds();
// Use contour generator =======================================================
开发者ID:Dru89,项目名称:DefinitelyTyped,代码行数:31,代码来源:d3-contour-tests.ts
示例4: select
import { select, event as d3event } from 'd3-selection'
import { range } from 'd3-array'
import { measureAll } from '../bench'
import { zoom, ZoomTransform } from 'd3-zoom'
import { ViewWindowTransform } from '../../ViewWindowTransform'
// import { transformVector, pSubP, pSubV, Vector, newVector, newPoint, identityTransform } from '../../affine'
import { identityTransform } from '../../affine'
import { betweenBasesAR1 } from '../../viewZoomTransform'
import { updateNode } from '../../MyTransform'
var svg = select("svg"),
width = +svg.attr("width"),
height = +svg.attr("height");
var points = range(2000).map(phyllotaxis(10));
var g = svg.append("g");
// var refNode: SVGGElement = svg.append("g").node() as SVGGElement
const svgNode = svg.node() as SVGSVGElement
g.selectAll("circle")
.data(points)
.enter().append("circle")
.attr("cx", function(d) { return d[0]; })
.attr("cy", function(d) { return d[1]; })
.attr("r", 2.5);
svg.append("rect")
.attr("width", width)
开发者ID:streamcode9,项目名称:svg-time-series,代码行数:31,代码来源:index.ts
注:本文中的d3-array.range函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论