本文整理汇总了TypeScript中d3-interpolate.interpolateString函数的典型用法代码示例。如果您正苦于以下问题:TypeScript interpolateString函数的具体用法?TypeScript interpolateString怎么用?TypeScript interpolateString使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了interpolateString函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
enterTransition = enterTransition.attrTween('r', function (d, i, g) {
let that: SVGCircleElement = this;
// let that2: HTMLElement = this; // fails, type mismatch
let datum: CircleDatum = d;
let index: number = i;
let group: SVGCircleElement[] | ArrayLike<SVGCircleElement> = g;
console.log(this.r.baseVal.value); // this type is SVGCircleElement
return interpolateString(0, d.r); // datum type is CircleDatum
});
示例2: NumCoercible
// 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
arrNum = iArrayNum(0.5);
iArrayNum = d3Interpolate.interpolateArray<[number, number]>(['1', '2'], [4, 8]); // explicit typing
arrNum = iArrayNum(0.5);
iArrayStr = d3Interpolate.interpolateArray<Array<string>>(['1', '2'], ['4', '8']); // explicit typing
示例3: function
enterTransition = enterTransition.attrTween('r', function (d, i, group) {
console.log(this.r.baseVal.value); // this type is SVGCircleElement
return interpolateString(0, d.r); // datum type is CircleDatum
});