當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript d3-interpolate.interpolateRound函數代碼示例

本文整理匯總了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;未經允許,請勿轉載。