本文整理汇总了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()
}
示例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();
示例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);