本文整理汇总了TypeScript中d3-shape.curveCardinal类的典型用法代码示例。如果您正苦于以下问题:TypeScript curveCardinal类的具体用法?TypeScript curveCardinal怎么用?TypeScript curveCardinal使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了curveCardinal类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: area
defaultArea = defaultArea.defined(true);
area = area.defined((d, t, data) => {
console.log('Number of Points: ', data.length);
console.log('Y0-Coordinate of first point: ', data[0].y0); // data type is Array<AreaDatum>
return !d.missing; // d type is AreaDatum
});
areaDefAccessorFn = area.defined();
// curve(...) ------------------------------------------------------------------------
defaultArea = defaultArea.curve(d3Shape.curveLinear);
area = area.curve(d3Shape.curveCardinal.tension(0.5));
// area = area.curve(d3Shape.curveBundle.beta(0.5)); // fails, as curveBundle-based line generator does not support area-related methods
currentCurveFactory = area.curve();
// use Area generator ===============================================================
defaultArea([[10, 10], [20, 10], [20, 20]]);
const areaData: AreaDatum[] = [
{ x0: 10, y0: 10, x1: 10, y1: 30, missing: false },
{ x0: 20, y0: 20, x1: 20, y1: 40, missing: false },
{ x0: 30, y0: 30, x1: 30, y1: 30, missing: false }
];
const areaPathStringMaybe: string | null = area(areaData);
示例2: area
defaultArea = defaultArea.defined(true);
area = area.defined(function (d, t, data) {
console.log('Number of Points: ', data.length);
console.log('Y0-Coordinate of first point: ', data[0].y0); // data type is Array<AreaDatum>
return !d.missing; // d type is AreaDatum
});
areaDefAccessorFn = area.defined();
// curve(...) ------------------------------------------------------------------------
defaultArea = defaultArea.curve(d3Shape.curveLinear);
area = area.curve(d3Shape.curveCardinal.tension(0.5));
// area = area.curve(d3Shape.curveBundle.beta(0.5)); // fails, as curveBundle-based line generator does not support area-related methods
currentCurveFactory = area.curve();
// use Area generator ===============================================================
defaultArea([[10, 10], [20, 10], [20, 20]]);
let areaData: Array<AreaDatum> = [
{ x0: 10, y0: 10, x1: 10, y1: 30, missing: false },
{ x0: 20, y0: 20, x1: 20, y1: 40, missing: false },
{ x0: 30, y0: 30, x1: 30, y1: 30, missing: false }
];
let areaPathString: string = area(areaData);