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


TypeScript d3-path.path函數代碼示例

本文整理匯總了TypeScript中d3-path.path函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript path函數的具體用法?TypeScript path怎麽用?TypeScript path使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了path函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: swapXY

 return d => {
   const srcNode = d.source
   const tgtNode = d.target
   const src = swapXY(cR(srcNode))
   const tgt = swapXY(cL(tgtNode))
   const path = d3Path.path()
   path.moveTo(src.x, src.y)
   const midX = Math.floor((src.x + tgt.x) / 2)
   // const midY = Math.floor((src.y + tgt.y) / 2)
   path.bezierCurveTo(midX, src.y, midX, tgt.y, tgt.x, tgt.y)
   return path.toString()
 }
開發者ID:Ptival,項目名稱:PeaCoq,代碼行數:12,代碼來源:utils.ts

示例2: lineOnlyFactory

areaRadialLineGenerator = radialArea.lineStartAngle();
areaRadialLineGenerator = radialArea.lineInnerRadius();
areaRadialLineGenerator = radialArea.lineEndAngle();
areaRadialLineGenerator = radialArea.lineOuterRadius();

// -----------------------------------------------------------------------------------
// Test Curve Factories
// -----------------------------------------------------------------------------------

// Test General interfaces -----------------------------------------------------------

let lineOnlyGenerator: d3Shape.CurveGeneratorLineOnly;

const lineOnlyFactory: d3Shape.CurveFactoryLineOnly = d3Shape.curveBundle;

lineOnlyGenerator = lineOnlyFactory(path());
lineOnlyGenerator = lineOnlyFactory(context!); // force context to be non-null with post-fix for mock

lineOnlyGenerator.lineStart();
lineOnlyGenerator.lineEnd();
lineOnlyGenerator.point(10, 20);

let curveGenerator: d3Shape.CurveGenerator;

let curveFactory: d3Shape.CurveFactory = d3Shape.curveBasis;

curveGenerator = curveFactory(path());
curveGenerator = curveFactory(context!);  // force context to be non-null with post-fix for mock

curveGenerator.lineStart();
curveGenerator.lineEnd();
開發者ID:Georadix,項目名稱:DefinitelyTyped,代碼行數:31,代碼來源:d3-shape-tests.ts

示例3:

/**
 * Typescript definition tests for d3/d3-path module
 *
 * Note: These tests are intended to test the definitions only
 * in the sense of typing and call signature consistency. They
 * are not intended as functional tests.
 */

import * as d3Path from 'd3-path';

// -----------------------------------------------------------------------------------------
// Test create new path serializer
// -----------------------------------------------------------------------------------------

const context: d3Path.Path = d3Path.path();

// -----------------------------------------------------------------------------------------
// Test path serializer methods
// -----------------------------------------------------------------------------------------

context.moveTo(50, 50);

context.lineTo(100, 100);

context.quadraticCurveTo(150, 200, 200, 100);

context.bezierCurveTo(300, 50, 400, 200, 500, 100);

context.arcTo(250, 250, 300, 300, 60);

context.arc(400, 400, 50, 0, Math.PI / 2);
開發者ID:AbraaoAlves,項目名稱:DefinitelyTyped,代碼行數:31,代碼來源:d3-path-tests.ts


注:本文中的d3-path.path函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。