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

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

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

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



在下文中一共展示了max函数的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: accessorReadOnlyMixedObjectToNumOrUndefined

    return datum ? datum.str : undefined;
}

function accessorReadOnlyMixedObjectToNumOrUndefined(datum: MixedObject | undefined, index: number, array: ArrayLike<MixedObject | undefined>): number | undefined | null {
    return datum ? datum.num : undefined;
}

// -----------------------------------------------------------------------------
// Test Statistics
// -----------------------------------------------------------------------------

// max() -----------------------------------------------------------------------

// without accessors

numOrUndefined = d3Array.max(numbersArray);
strOrUndefined = d3Array.max(stringyNumbersArray);
numericOrUndefined = d3Array.max(numericArray);
dateOrUndefined = d3Array.max(dateArray);

// ArrayLike test cases

numOrUndefined = d3Array.max(typedArray);
numOrUndefined = d3Array.max(readonlyNumbersOrUndefinedArray);
strOrUndefined = d3Array.max(readonlyStringyNumbersArray);
numericOrUndefined = d3Array.max(readonlyNumericArray);
dateOrUndefined = d3Array.max(readonlyDateArray);

// with accessors

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


示例3: accessorMixedObjectToStrOrUndefined

    return datum ? datum.num : undefined;
}

function accessorMixedObjectToStrOrUndefined(datum: MixedObject | undefined, index: number, array: MixedObject[]): string | undefined | null {
    return datum ? datum.str : undefined;
}

// -----------------------------------------------------------------------------
// Test Statistics
// -----------------------------------------------------------------------------

// max() -----------------------------------------------------------------------

// without accessors

numOrUndefined = d3Array.max(numbersArray);
strOrUndefined = d3Array.max(stringyNumbersArray);
numericOrUndefined = d3Array.max(numericArray);
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() -----------------------------------------------------------------------
开发者ID:Kroisse,项目名称:DefinitelyTyped,代码行数:30,代码来源:d3-array-tests.ts


示例4: 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


示例5: MixedObject

    new MixedObject(20, new Date(2016, 7, 30)),
    new MixedObject(30, new Date(2015, 3, 15)),
    new MixedObject(40, new Date(2014, 3, 15)),
    new MixedObject(50, new Date(2017, 4, 15))
];


// -----------------------------------------------------------------------------
// Test Statistics
// -----------------------------------------------------------------------------

// max() -----------------------------------------------------------------------

// without accessors

num = d3Array.max(numbersArray);
str = d3Array.max(stringyNumbersArray);
numeric = d3Array.max(numericArray);
date = d3Array.max(dateArray);

// with accessors

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

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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript d3-array.mean函数代码示例发布时间:2022-05-24
下一篇:
TypeScript d3-array.histogram函数代码示例发布时间: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