• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript d3-array.mean函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中d3-array.mean函数的典型用法代码示例。如果您正苦于以下问题:TypeScript mean函数的具体用法?TypeScript mean怎么用?TypeScript mean使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了mean函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: d3Mean

 const ComponentUsages: GetTargetClusterUsageEx.ComponentUsage[] = tcu.ComponentUsages.ComponentUsage.map(cu => {
     const MachineUsages = cu.MachineUsages.MachineUsage.map(mu => {
         const DiskUsages: GetTargetClusterUsageEx.DiskUsage[] = mu.DiskUsages && mu.DiskUsages.DiskUsage ? mu.DiskUsages.DiskUsage.map(du => {
             return {
                 ...du,
                 Total: du.InUse + du.Available,
                 PercentUsed: 100 - du.PercentAvailable
             };
         }) : [];
         return {
             Name: mu.Name,
             NetAddress: mu.NetAddress,
             Description: mu.Description,
             DiskUsages,
             mean: d3Mean(DiskUsages, du => du.PercentUsed),
             max: d3Max(DiskUsages, du => du.PercentUsed)
         };
     });
     return {
         Type: cu.Type,
         Name: cu.Name,
         Description: cu.Description,
         MachineUsages,
         MachineUsagesDescription: MachineUsages.reduce((prev, mu) => prev + (mu.Description || ""), ""),
         mean: d3Mean(MachineUsages, mu => mu.mean),
         max: d3Max(MachineUsages, mu => mu.max)
     };
 });
开发者ID:GordonSmith,项目名称:Visualization,代码行数:28,代码来源:wsMachine.ts


示例2: commonValues

 // Exclude any major outliers for legend calculation (they will be relegated to open-ended bins)
 @computed get commonValues(): number[] {
     const {sortedNumericValues} = this
     if (!sortedNumericValues.length) return []
     const sampleMean = mean(sortedNumericValues) as number
     const sampleDeviation = deviation(sortedNumericValues) as number
     return sortedNumericValues.filter(d => Math.abs(d-sampleMean) <= sampleDeviation*2)
 }
开发者ID:OurWorldInData,项目名称:owid-grapher,代码行数:8,代码来源:MapData.ts


示例3:

numericOrUndefinedExtent = d3Array.extent(readonlyNumericArray);
dateOrUndefinedExtent = d3Array.extent(readonlyDateArray);

// with accessors

numOrUndefinedExtent = d3Array.extent(mixedObjectArray, accessorMixedObjectToNum);
strOrUndefinedExtent = d3Array.extent(mixedObjectArray, accessorMixedObjectToStr);
mixedOrUndefinedExtent = d3Array.extent(mixedObjectArray, accessorMixedObjectToNumeric);
dateMixedOrUndefined = d3Array.extent(mixedObjectArray, accessorMixedObjectToDate);
numOrUndefinedExtent = d3Array.extent(mixedObjectArray, accessorMixedObjectToNumOrUndefined);
strOrUndefinedExtent = d3Array.extent(mixedObjectArray, accessorMixedObjectToStrOrUndefined);
numOrUndefinedExtent = d3Array.extent(readonlyMixedObjectOrUndefinedArray, accessorReadOnlyMixedObjectToNumOrUndefined);

// mean() ----------------------------------------------------------------------

numOrUndefined = d3Array.mean(numbersArray);
numOrUndefined = d3Array.mean(numericArray);
numOrUndefined = d3Array.mean(numbersOrUndefinedArray);

numOrUndefined = d3Array.mean(typedArray);
numOrUndefined = d3Array.mean(readonlyNumbersOrUndefinedArray);
numOrUndefined = d3Array.mean(readonlyNumericArray);
numOrUndefined = d3Array.mean(readonlyNumbersOrUndefinedArray);

numOrUndefined = d3Array.mean(mixedObjectArray, accessorMixedObjectToNum);
numOrUndefined = d3Array.mean(mixedObjectOrUndefinedArray, accessorMixedObjectToNumOrUndefined);
numOrUndefined = d3Array.mean(readonlyMixedObjectOrUndefinedArray, accessorReadOnlyMixedObjectToNumOrUndefined);

// median() --------------------------------------------------------------------

numOrUndefined = d3Array.median(numbersArray);
开发者ID:itslenny,项目名称:DefinitelyTyped,代码行数:31,代码来源:d3-array-tests.ts


示例4:

strOrUndefinedExtent = d3Array.extent(stringyNumbersArray);
numericOrUndefinedExtent = d3Array.extent(numericArray);
dateOrUndefinedExtent = d3Array.extent(dateArray);

// with accessors

numOrUndefinedExtent = d3Array.extent(mixedObjectArray, accessorMixedObjectToNum);
strOrUndefinedExtent = d3Array.extent(mixedObjectArray, accessorMixedObjectToStr);
mixedOrUndefinedExtent = d3Array.extent(mixedObjectArray, accessorMixedObjectToNumeric);
dateMixedOrUndefined = d3Array.extent(mixedObjectArray, accessorMixedObjectToDate);
numOrUndefinedExtent = d3Array.extent(mixedObjectArray, accessorMixedObjectToNumOrUndefined);
strOrUndefinedExtent = d3Array.extent(mixedObjectArray, accessorMixedObjectToStrOrUndefined);

// mean() ----------------------------------------------------------------------

numOrUndefined = d3Array.mean(numbersArray);
numOrUndefined = d3Array.mean(numericArray);
numOrUndefined = d3Array.mean(numbersOrUndefinedArray);

numOrUndefined = d3Array.mean(mixedObjectArray, accessorMixedObjectToNum);
numOrUndefined = d3Array.mean(mixedObjectOrUndefinedArray, accessorMixedObjectToNumOrUndefined);

// median() --------------------------------------------------------------------

numOrUndefined = d3Array.median(numbersArray);
numOrUndefined = d3Array.median(numericArray);
numOrUndefined = d3Array.median(numbersOrUndefinedArray);

numOrUndefined = d3Array.median(mixedObjectArray, accessorMixedObjectToNum);
numOrUndefined = d3Array.median(mixedObjectOrUndefinedArray, accessorMixedObjectToNumOrUndefined);
开发者ID:Kroisse,项目名称:DefinitelyTyped,代码行数:30,代码来源:d3-array-tests.ts


示例5: function

    let d: MixedObject = datum;
    let i: number = index;
    let arr: Array<MixedObject> = array;
    return datum.numeric;
});

extentDateMixed = d3Array.extent(mixedObjectArray, function (datum, index, array) {
    let d: MixedObject = datum;
    let i: number = index;
    let arr: Array<MixedObject> = array;
    return datum.date;
});

// mean() ----------------------------------------------------------------------

num = d3Array.mean(numbersArray);

num = d3Array.mean(mixedObjectArray, function (datum, index, array) {
    let d: MixedObject = datum;
    let i: number = index;
    let arr: Array<MixedObject> = array;
    return datum.num;
});

// median() --------------------------------------------------------------------

num = d3Array.median(numbersArray);

num = d3Array.median(mixedObjectArray, function (datum, index, array) {
    let d: MixedObject = datum;
    let i: number = index;
开发者ID:DmitryEfimenko,项目名称:DefinitelyTyped,代码行数:31,代码来源:d3-array-tests.ts



注:本文中的d3-array.mean函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript d3-array.median函数代码示例发布时间:2022-05-24
下一篇:
TypeScript d3-array.max函数代码示例发布时间:2022-05-24
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap