File

src/app/model/d3/d3.link.ts

Description

Link (edge) class with D3.js compatability.

Implements

D3Link

Index

Properties

Constructor

Public constructor(source: D3Node, target: D3Node, initialRelations?: string[], initialFunctions?: string[])
Parameters :
Name Type Optional
source D3Node No
target D3Node No
initialRelations string[] Yes
initialFunctions string[] Yes

Properties

Public Readonly functions
Default value : new Set<string>()
Public Readonly relations
Default value : new Set<string>()
Public Readonly source
Type : D3Node
Public Readonly target
Type : D3Node
import { SimulationLinkDatum } from 'd3';

import { D3Node } from 'src/app/model/d3/d3.node';

/**
 * Link (edge) interface with D3.js compatability.
 * Required for strict type-checking.
 */
export interface D3Link extends SimulationLinkDatum<D3Node> {
  source: D3Node;
  target: D3Node;
  relations: Set<string>;
  functions: Set<string>;
}

/**
 * Link (edge) class with D3.js compatability.
 */
export class ApolloLink implements D3Link {
  public readonly relations = new Set<string>();
  public readonly functions = new Set<string>();

  public constructor(
    public readonly source: D3Node,
    public readonly target: D3Node,
    initialRelations?: string[],
    initialFunctions?: string[],
  ) {
    initialRelations?.forEach((relation) => this.relations.add(relation));
    initialFunctions?.forEach((functions) => this.functions.add(functions));
  }
}

results matching ""

    No results matching ""