当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript d3-shape.line函数代码示例

本文整理汇总了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)
	}
开发者ID:streamcode9,项目名称:svg-time-series,代码行数:9,代码来源:index.ts

示例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);
}
开发者ID:fykosak,项目名称:fksdb,代码行数:11,代码来源:lines.ts

示例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(...) ----------------------------------------------------------------------------
开发者ID:Georadix,项目名称:DefinitelyTyped,代码行数:30,代码来源:d3-shape-tests.ts

示例4: getLineGenerator

 private getLineGenerator(): Line<CsiDTO> {
   return line<CsiDTO>()
     .curve(curveCatmullRom)
     .x((csiDTO: CsiDTO) => this.calculateX(csiDTO))
     .y((csiDTO: CsiDTO) => this.calculateY(csiDTO))
 }
开发者ID:iteratec,项目名称:OpenSpeedMonitor,代码行数:6,代码来源:csi-graph.calculator.ts

示例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])
开发者ID:streamcode9,项目名称:svg-time-series,代码行数:6,代码来源:draw.ts

示例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;
开发者ID:MaximKudriavtsev,项目名称:devextreme-reactive,代码行数:31,代码来源:computeds.ts

示例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)
开发者ID:streamcode9,项目名称:svg-time-series,代码行数:6,代码来源:index.ts

示例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)
开发者ID:streamcode9,项目名称:svg-time-series,代码行数:6,代码来源:index.ts


注:本文中的d3-shape.line函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。