Made id and other fields on graphnode and graphlink optional. removed LinkCurvatureType which doesnt exist and caused exception when used (#38818)

This commit is contained in:
Noah Santschi-Cooney 2019-10-11 00:33:48 +01:00 committed by Armando Aguirre
parent 4c52cecef4
commit 3ef1069095
2 changed files with 7 additions and 16 deletions

View File

@ -32,9 +32,8 @@ graph
.linkAutoColorBy((link) => link.type)
.linkWidth(1)
.linkWidth((link) => 1)
.linkCurvature(ForceGraph.LinkCurvatureType.Straight)
.linkCurvature('curvature')
.linkCurvature((link) => ForceGraph.LinkCurvatureType.Straight)
.linkCurvature((link) => 0.5)
.linkCanvasObject((link, ctx, scale) => {})
.linkDirectionalArrowLength(0)
.linkDirectionalArrowLength('length')

View File

@ -1,6 +1,7 @@
// Type definitions for force-graph 1.15
// Type definitions for force-graph 1.21
// Project: https://github.com/vasturiano/force-graph
// Definitions by: Peter Kimberley <https://github.com/p-kimberley>
// Noah Santschi-Cooney <https://github.com/Strum355>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare function ForceGraph(): ForceGraph.ForceGraphInstance;
@ -16,12 +17,12 @@ declare namespace ForceGraph {
}
interface GraphEntity {
id: string;
id?: string;
}
interface GraphNode extends GraphEntity {
name: string;
val: any;
name?: string;
val?: any;
}
interface GraphNodeObject extends GraphNode {
@ -41,15 +42,6 @@ declare namespace ForceGraph {
target: GraphNode;
}
/**
* Enums
*/
enum LinkCurvatureType {
Straight = 0,
HalfLineLength = 1
}
/**
* Types
*/
@ -107,7 +99,7 @@ declare namespace ForceGraph {
linkColor(color?: string | LinkAccessorFn<string>): ForceGraphInstance & (string | LinkAccessorFn<string>);
linkAutoColorBy(attribute?: string | LinkAccessorFn<string>): ForceGraphInstance & (string | LinkAccessorFn<string>);
linkWidth(width?: number | string | LinkAccessorFn<number>): ForceGraphInstance & (number | string | LinkAccessorFn<number>);
linkCurvature(curvature?: LinkCurvatureType | string | LinkAccessorFn<LinkCurvatureType>): ForceGraphInstance;
linkCurvature(curvature?: number | string | LinkAccessorFn<number>): ForceGraphInstance;
linkCanvasObject(callback?: LinkCanvasCallbackFn): ForceGraphInstance & LinkCanvasCallbackFn;
linkDirectionalArrowLength(length?: number | string | LinkAccessorFn<number>): ForceGraphInstance & (number | string | LinkAccessorFn<number>);
linkDirectionalArrowColor(color?: string | LinkAccessorFn<string>): ForceGraphInstance & (string | LinkAccessorFn<string>);