本文整理匯總了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);