本文整理汇总了TypeScript中d3-shape.line函数的典型用法代码示例。如果您正苦于以下问题:TypeScript line函数的具体用法?TypeScript line怎么用?TypeScript line使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了line函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: line
const drawLine = (cityIdx: number, off: number) => {
const idx = (i: number) => (i + off) % dataLength
return line()
.defined((d, i, arr) => !isNaN(arr[idx(i)][cityIdx]))
.x((d, i) => i)
.y((d, i, arr) => arr[idx(i)][cityIdx])
.call(null, data)
}
示例2: getLinePath
export function getLinePath(scales: Scales, data: PointData[], curve: CurveFactory = curveLinear): string {
const {xScale, yScale} = scales;
return line<PointData>()
.x((element: ExtendedSubmit) => {
return xScale(new Date(element.created));
})
.y((element: ExtendedSubmit) => {
return yScale(element.totalPoints);
})
.curve(curve)(data);
}
示例3:
let lineXYAccessorFn: (d: LineDatum, index?: number, data?: LineDatum[]) => number;
let lineDefAccessorFn: (d: LineDatum, index?: number, data?: LineDatum[]) => boolean;
interface RadialLineDatum {
angle: number;
radius: number;
missing: boolean;
}
let radialLineAngRAccessorFn: (d: RadialLineDatum, index?: number, data?: RadialLineDatum[]) => number;
let radialLineDefAccessorFn: (d: RadialLineDatum, index?: number, data?: RadialLineDatum[]) => boolean;
// line(...) create Line generator =====================================================
let defaultLine: d3Shape.Line<[number, number]> = d3Shape.line();
let line: d3Shape.Line<LineDatum> = d3Shape.line<LineDatum>();
// configure Line(...) generator ======================================================
// context(...) ----------------------------------------------------------------------
if (context !== null) {
defaultLine = defaultLine.context(context); // draw to canvas
}
context = defaultLine.context();
line = line.context(null); // use as path string generator for SVG
// x(...) ----------------------------------------------------------------------------
示例4: getLineGenerator
private getLineGenerator(): Line<CsiDTO> {
return line<CsiDTO>()
.curve(curveCatmullRom)
.x((csiDTO: CsiDTO) => this.calculateX(csiDTO))
.y((csiDTO: CsiDTO) => this.calculateY(csiDTO))
}
示例5: line
const drawLine = (cityIdx: number) => line()
.defined((d: [number, number]) => {
return !(isNaN(d[cityIdx]) || d[cityIdx] == null)
})
.x((d: [number, number], i: number) => i)
.y((d: [number, number]) => d[cityIdx])
示例6:
} from '../../types';
import { ARGUMENT_DOMAIN } from '../../constants';
import { getWidth, getValueDomainName, fixOffset } from '../../utils/scale';
const getX = ({ x }: PointComponentProps) => x;
const getY = ({ y }: PointComponentProps) => y;
const getY1 = ({ y1 }: PointComponentProps) => y1!;
/** @internal */
export const dArea: PathFn = area<PointComponentProps>()
.x(getX)
.y1(getY)
.y0(getY1) as any;
/** @internal */
export const dLine: PathFn = line<PointComponentProps>()
.x(getX)
.y(getY) as any;
/** @internal */
export const dSpline: PathFn = line<PointComponentProps>()
.x(getX)
.y(getY)
.curve(curveMonotoneX) as any;
/** @internal */
export const getPiePointTransformer: GetPointTransformerFn = ({
argumentScale, valueScale, points,
}) => {
const x = Math.max(...argumentScale.range()) / 2;
const y = Math.max(...valueScale.range()) / 2;
示例7: calcDate
path.attr('d', (cityIdx: number) =>
d3shape.line()
.defined((d: number[]) => d[cityIdx])
.x((d: number[], i: number) => calcDate(i, startDate, 86400000))
.y((d: number[]) => d[cityIdx])
.call(null, data)
示例8:
path.attr('d', (cityIdx: number) =>
d3shape.line()
.defined((d: number[]) => d[cityIdx])
.x((d: number[], i: number) => i)
.y((d: number[]) => d[cityIdx])
.call(null, data)