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

TypeScript d3-interpolate.interpolateRound函数代码示例

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

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



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

示例1: interpolator

 .attrTween('y', (d, i, a) => {
   const interpolator = d3Interpolate.interpolateRound(d.data.currentScaledY, HierarchyNodeUtils.getDestinationScaledY(d))
   return t => {
     d.data.currentScaledY = interpolator(t)
     return `${d.data.currentScaledY}`
   }
 })
开发者ID:Ptival,项目名称:PeaCoq,代码行数:7,代码来源:rect-selection.ts


示例2: return

 .attrTween('y', (d : ProofTreeTypes.Node) : (t : number) => string => {
   const destinationScaledY = HierarchyNodeUtils.getHierarchyGoalAncestor(d).caseOf({
     nothing : () => HierarchyNodeUtils.getDestinationScaledY(d),
     just : (gp : ProofTreeTypes.Node) => HierarchyNodeUtils.getDestinationScaledY(gp),
   })
   const interpolator = d3Interpolate.interpolateRound(d.data.currentScaledY, destinationScaledY)
   return (t : number) => {
     d.data.currentScaledY = interpolator(t)
     return `${d.data.currentScaledX}`
   }
 })
开发者ID:Ptival,项目名称:PeaCoq,代码行数:11,代码来源:text-selection.ts


示例3: NumCoercible

// Key Value

iKeyVal = d3Interpolate.interpolate({ x: 0, y: 1 }, { x: 1, y: 10, z: 100 });

d3Interpolate.interpolate<NumCoercible>(new NumCoercible(1), new NumCoercible(5));
d3Interpolate.interpolate<NumCoercible>({ a: 1 }, new NumCoercible(5));

// test interpolateNumber(a, b) signature ----------------------------------------------------

iNum = d3Interpolate.interpolateNumber(0, 100);
iNum = d3Interpolate.interpolateNumber(new NumCoercible(0), new NumCoercible(100));
num = iNum(0.5);

// test interpolateNumber(a, b) signature ----------------------------------------------------

iNum = d3Interpolate.interpolateRound(0, 100);
iNum = d3Interpolate.interpolateRound(new NumCoercible(0), new NumCoercible(100));
num = iNum(0.5);

// test interpolateString(a, b) signature ----------------------------------------------------

iString = d3Interpolate.interpolateString('-1', '2');
str = iString(0.5);

// test interpolateDate(a, b) signature ----------------------------------------------------

iDate = d3Interpolate.interpolateDate(new Date(2016, 6, 1), new Date(2016, 6, 31));

// test interpolateArray(a, b) signature ----------------------------------------------------

iArrayNum = d3Interpolate.interpolateArray<Array<number>>([1, 2], [4, 8]); // explicit typing
开发者ID:ArtemZag,项目名称:DefinitelyTyped,代码行数:31,代码来源:d3-interpolate-tests.ts


示例4: divergingScaleNumber

const copiedSequentialScale: d3Scale.ScaleSequential<string> = sequentialScaleColorString.copy();

// -------------------------------------------------------------------------------
// Diverging Scale Factory
// -------------------------------------------------------------------------------

// scaleQuantize() -----------------------------------------------------------------

const interpolateDouble = (t: number) => t * 2;
let divergingScaleNumber: d3Scale.ScaleDiverging<number>;
let divergingScaleString: d3Scale.ScaleDiverging<string>;

// $ExpectError
d3Scale.scaleDiverging(); // fails, Expected 1 arguments, but got 0.

divergingScaleNumber = d3Scale.scaleDiverging<number>(interpolateRound(0, 1));
divergingScaleNumber = d3Scale.scaleDiverging<number>(interpolateDouble);
divergingScaleString = d3Scale.scaleDiverging<string>(interpolateSpectral);

// ScaleDiverging Interface =======================================================

// (...) value mapping from domain to output -----------------------------------

outputNumber = divergingScaleNumber(1);
outputString = divergingScaleString(1);

// domain(...) -----------------------------------------------------------------

let domainDivergingScale: [number, number, number];

divergingScaleNumber = divergingScaleNumber.domain([0, 0.5, 1]);
开发者ID:CNBoland,项目名称:DefinitelyTyped,代码行数:31,代码来源:d3-scale-tests.ts


示例5: NumCoercible

iKeyVal = d3Interpolate.interpolate({ x: 0, y: 1 }, { x: 1, y: 10, z: 100 });
iXyz = d3Interpolate.interpolate({ x: 0, y: 1 }, { x: 1, y: 10, z: 100 });
iXyz = d3Interpolate.interpolate<Xyz>({ x: 0, y: 1 }, { x: 1, y: 10, z: 100 });

d3Interpolate.interpolate<NumCoercible>(new NumCoercible(1), new NumCoercible(5));
d3Interpolate.interpolate<NumCoercible>({ a: 1 }, new NumCoercible(5));

// test interpolateNumber(a, b) signature ----------------------------------------------

iNum = d3Interpolate.interpolateNumber(0, 100);
iNum = d3Interpolate.interpolateNumber(new NumCoercible(0), new NumCoercible(100));
num = iNum(0.5);

// test interpolateNumber(a, b) signature ----------------------------------------------

iNum = d3Interpolate.interpolateRound(0, 100);
iNum = d3Interpolate.interpolateRound(new NumCoercible(0), new NumCoercible(100));
num = iNum(0.5);

// test interpolateString(a, b) signature ----------------------------------------------

iString = d3Interpolate.interpolateString('-1', '2');
str = iString(0.5);

// test interpolateDate(a, b) signature ------------------------------------------------

iDate = d3Interpolate.interpolateDate(new Date(2016, 6, 1), new Date(2016, 6, 31));

// test interpolateArray(a, b) signature -----------------------------------------------

iArrayNum = d3Interpolate.interpolateArray<number[]>([1, 2], [4, 8]); // explicit typing
开发者ID:AlexGalays,项目名称:DefinitelyTyped,代码行数:31,代码来源:d3-interpolate-tests.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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