本文整理汇总了TypeScript中d3-array.min函数的典型用法代码示例。如果您正苦于以下问题:TypeScript min函数的具体用法?TypeScript min怎么用?TypeScript min使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了min函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1:
return l.num;
});
strOrUndefined = d3Array.max(mixedObjectArray, (d) => {
const l: MixedObject = d;
return l.str;
});
// $ExpectError
numOrUndefined = d3Array.max(readonlyNumbersArray, (d, i, a) => { a.push(3); return 0; });
// min() -----------------------------------------------------------------------
// without accessors
numOrUndefined = d3Array.min(numbersArray);
strOrUndefined = d3Array.min(stringyNumbersArray);
numericOrUndefined = d3Array.min(numericArray);
dateOrUndefined = d3Array.min(dateArray);
// ArrayLike test cases
numOrUndefined = d3Array.min(typedArray);
numOrUndefined = d3Array.min(readonlyNumbersOrUndefinedArray);
strOrUndefined = d3Array.min(readonlyStringyNumbersArray);
numericOrUndefined = d3Array.min(readonlyNumericArray);
dateOrUndefined = d3Array.min(readonlyDateArray);
// with accessors
numOrUndefined = d3Array.min(mixedObjectArray, accessorMixedObjectToNum);
开发者ID:itslenny,项目名称:DefinitelyTyped,代码行数:31,代码来源:d3-array-tests.ts
示例2: update
public update(data: any[]) {
let propertyX = this.config.get('propertyX'),
propertyY = this.config.get('propertyY'),
propertyZ = this.config.get('propertyZ'),
colorScale = this.config.get('colorScale'),
xStep: number = this.config.get('xStep'),
yStep: number = this.config.get('yStep'),
yAxisType = this.config.get('yAxisType'),
xAxisType = this.config.get('xAxisType'),
x = this.x.xAxis.scale(),
y = this.y.yAxis.scale(),
width: number = 0,
heigth: number = 0,
minX = +min(data, (d) => +d[propertyX]),
minY = +min(data, (d) => +d[propertyY]),
maxX = +max(data, (d) => +d[propertyX]),
maxY = +max(data, (d) => +d[propertyY]);
colorScale.domain([min(data, (d) => +d[propertyZ]), max(data, (d) => +d[propertyZ])]);
if (xAxisType === 'linear') {
this.x.updateDomainByMinMax(minX, maxX + xStep);
this.x.transition();
width = x(xStep) - x(0);
} else if (xAxisType === 'categorical') {
width = x.step();
}
if (yAxisType === 'linear') {
this.y.updateDomainByMinMax(minY, maxY + yStep);
this.y.transition();
heigth = y(0) - y(yStep);
} else if (yAxisType === 'categorical') {
heigth = y.step();
}
// Data join
let tiles = this.svg.selectAll('.tile')
.data(data);
// Update
tiles.attr('class', 'tile')
.attr('x', (d) => x(d[propertyX]))
.attr('y', (d) => {
if (yAxisType === 'linear') {
return y(+d[propertyY] + yStep);
} else {
return y(d[propertyY]);
}
})
.attr('width', width)
.attr('height', heigth)
.attr('fill-opacity', 1)
.style('fill', (d) => colorScale(d[propertyZ]));
// Enter
let entering = tiles
.enter().append('rect')
.attr('class', 'tile')
.attr('x', (d) => x(d[propertyX]))
.attr('y', (d) => {
if (yAxisType === 'linear') {
return y(+d[propertyY] + yStep);
} else {
return y(d[propertyY]);
}
})
.attr('width', width)
.attr('height', heigth)
.style('fill', (d) => colorScale(d[propertyZ]))
.attr('fill-opacity', 0)
.attr('fill-opacity', 1);
// Exit
tiles.exit().remove();
tiles
.on('mousedown.user', this.config.get('onDown'))
.on('mouseup.user', this.config.get('onUp'))
.on('mouseleave.user', this.config.get('onLeave'))
.on('mouseover.user', this.config.get('onHover'))
.on('click.user', this.config.get('onClick'));
}
开发者ID:proteus-h2020,项目名称:proteus-charts,代码行数:82,代码来源:TileSet.ts
示例3:
dateOrUndefined = d3Array.max(dateArray);
// with accessors
numOrUndefined = d3Array.max(mixedObjectArray, accessorMixedObjectToNum);
strOrUndefined = d3Array.max(mixedObjectArray, accessorMixedObjectToStr);
numericOrUndefined = d3Array.max(mixedObjectArray, accessorMixedObjectToNumeric);
dateOrUndefined = d3Array.max(mixedObjectArray, accessorMixedObjectToDate);
numOrUndefined = d3Array.max(mixedObjectArray, accessorMixedObjectToNumOrUndefined);
strOrUndefined = d3Array.max(mixedObjectArray, accessorMixedObjectToStrOrUndefined);
// min() -----------------------------------------------------------------------
// without accessors
numOrUndefined = d3Array.min(numbersArray);
strOrUndefined = d3Array.min(stringyNumbersArray);
numericOrUndefined = d3Array.min(numericArray);
dateOrUndefined = d3Array.min(dateArray);
// with accessors
numOrUndefined = d3Array.min(mixedObjectArray, accessorMixedObjectToNum);
strOrUndefined = d3Array.min(mixedObjectArray, accessorMixedObjectToStr);
numericOrUndefined = d3Array.min(mixedObjectArray, accessorMixedObjectToNumeric);
dateOrUndefined = d3Array.min(mixedObjectArray, accessorMixedObjectToDate);
numOrUndefined = d3Array.min(mixedObjectArray, accessorMixedObjectToNumOrUndefined);
strOrUndefined = d3Array.min(mixedObjectArray, accessorMixedObjectToStrOrUndefined);
// extent() --------------------------------------------------------------------
开发者ID:Kroisse,项目名称:DefinitelyTyped,代码行数:30,代码来源:d3-array-tests.ts
示例4: function
let arr: Array<MixedObject> = array;
return datum.numeric;
});
date = d3Array.max(mixedObjectArray, function (datum, index, array) {
let d: MixedObject = datum;
let i: number = index;
let arr: Array<MixedObject> = array;
return datum.date;
});
// min() -----------------------------------------------------------------------
// without accessors
num = d3Array.min(numbersArray);
str = d3Array.min(stringyNumbersArray);
numeric = d3Array.min(numericArray);
date = d3Array.min(dateArray);
// with accessors
num = d3Array.min(mixedObjectArray, function (datum, index, array) {
let d: MixedObject = datum;
let i: number = index;
let arr: Array<MixedObject> = array;
return datum.num;
});
str = d3Array.min(mixedObjectArray, function (datum, index, array) {
let d: MixedObject = datum;
开发者ID:DmitryEfimenko,项目名称:DefinitelyTyped,代码行数:31,代码来源:d3-array-tests.ts
注:本文中的d3-array.min函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论