UNPKG

fybdp-d3-kg

Version:

Knowledge Graph using React and D3.js

50 lines (49 loc) 1.45 kB
/// <reference types="node" /> import EventEmitter from 'events'; import * as d3 from 'd3'; export interface IEventHandler<T> { onMouseover(n: T): void; onMouseout(n: T): void; onClick(n: T): void; onDblClick(n: T): void; } export interface IViewContext<T> { render(data: any): void; position(): void; } export declare class ViewContext<T> extends EventEmitter implements IViewContext<T>, IEventHandler<T> { graph: any; selection: d3.Selection; constructor(graph: any); /** * Renders all elements, * @param {Object} data * @param {Array} data.nodes * @param {Array} data.links */ render(data?: any): void; position(): void; highlightDependencies(data: any): void; /** * Classifies elements based on relationship to node parameter. * CSS styling is based on `data-rel` attribute set on the DOM element. * * @param {Node} node */ setRelationships(node: any): void; /** * Visually hides elements unrelated to node parameter. * CSS styling is based on `data-hidden` attribute set on the DOM element. * * @param {Node} node */ hideUnrelated(node: any): void; /** * Reset all styles, e.g. colors and visibility */ resetStyles(): void; onMouseover(n: T): void; onMouseout(n: T): void; onClick(n: T): void; onDblClick(n: T): void; }