mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Merge pull request #4664 from davidlipo/master
Changes to SigmaJs and Dagre
This commit is contained in:
Vendored
+8
-4
@@ -10,20 +10,24 @@ declare module Dagre{
|
||||
|
||||
interface Graph {
|
||||
new (): Graph;
|
||||
edges(): string[];
|
||||
edge(id: string): any;
|
||||
edges(): Edge[];
|
||||
edge(id: any): any;
|
||||
nodes(): string[];
|
||||
node(id: string): any;
|
||||
node(id: any): any;
|
||||
setDefaultEdgeLabel(callback: () => void): Graph;
|
||||
setEdge(sourceId: string, targetId: string): Graph;
|
||||
setGraph(options: { [key: string]: any }): Graph;
|
||||
setNode(id: string, node: { [key: string]: any }): Graph;
|
||||
}
|
||||
|
||||
interface Edge {
|
||||
v: string;
|
||||
w: string;
|
||||
}
|
||||
|
||||
interface GraphLib {
|
||||
Graph: Graph;
|
||||
}
|
||||
}
|
||||
|
||||
declare var dagre: Dagre.DagreFactory;
|
||||
|
||||
|
||||
@@ -23,6 +23,10 @@ module SigmaJsTests {
|
||||
s.refresh();
|
||||
});
|
||||
|
||||
sigma.canvas.edges['def'] = function() {};
|
||||
sigma.svg.nodes['def'] = {create: (obj: SigmaJs.Node) => { return new Element(); },
|
||||
update: (obj: SigmaJs.Node) => { return; }};
|
||||
|
||||
var N = 100;
|
||||
var E = 500;
|
||||
// Generate a random graph:
|
||||
|
||||
Vendored
+28
-1
@@ -15,10 +15,17 @@ declare module SigmaJs{
|
||||
graphPosition(x: number, y:number): {x: number; y: number};
|
||||
ratio: number;
|
||||
readPrefix: string;
|
||||
settings(setting: string) : any;
|
||||
x: number;
|
||||
y: number;
|
||||
}
|
||||
|
||||
interface Canvas {
|
||||
edges: {[renderType: string]: (edge: Edge, source: Node, target: Node, ...a:any[]) => void};
|
||||
labels: {[renderType: string]: (node: Node, ...a:any[]) => void};
|
||||
nodes: {[renderType: string]: (node: Node, ...a:any[]) => void};
|
||||
}
|
||||
|
||||
interface Classes {
|
||||
configurable: Configurable;
|
||||
graph: Graph;
|
||||
@@ -39,6 +46,7 @@ declare module SigmaJs{
|
||||
}
|
||||
|
||||
interface Edge {
|
||||
[key : string] : any;
|
||||
color?: string;
|
||||
id: string;
|
||||
size?: number;
|
||||
@@ -74,6 +82,11 @@ declare module SigmaJs{
|
||||
nodes(ids: string[]): Node[];
|
||||
}
|
||||
|
||||
interface GraphData {
|
||||
edges: Edge[];
|
||||
nodes: Node[];
|
||||
}
|
||||
|
||||
interface Image {
|
||||
clip?: number;
|
||||
scale?: number;
|
||||
@@ -87,6 +100,7 @@ declare module SigmaJs{
|
||||
}
|
||||
|
||||
interface Node {
|
||||
[key : string] : any;
|
||||
color?: string;
|
||||
id: string;
|
||||
image?: any;
|
||||
@@ -149,7 +163,7 @@ declare module SigmaJs{
|
||||
|
||||
interface SigmaConfigs {
|
||||
container?: Element;
|
||||
graph?: Graph;
|
||||
graph?: GraphData;
|
||||
id?: string;
|
||||
renderers?: Renderer[];
|
||||
settings?: { [index: string]: any };
|
||||
@@ -160,10 +174,12 @@ declare module SigmaJs{
|
||||
new(container: string): Sigma;
|
||||
new(container: Element): Sigma;
|
||||
new(configuration: SigmaConfigs): Sigma;
|
||||
canvas: Canvas;
|
||||
classes:Classes;
|
||||
misc: Miscellaneous;
|
||||
parsers: Parsers;
|
||||
plugins: Plugins;
|
||||
svg: SVG;
|
||||
}
|
||||
|
||||
interface Settings {
|
||||
@@ -269,6 +285,17 @@ declare module SigmaJs{
|
||||
// Animation settings
|
||||
animationsTime?: number;
|
||||
}
|
||||
|
||||
interface SVG {
|
||||
edges: {[renderType: string]: SVGObject<SigmaJs.Edge>};
|
||||
labels: {[renderType: string]: SVGObject<SigmaJs.Node>};
|
||||
nodes: {[renderType: string]: SVGObject<SigmaJs.Node>};
|
||||
}
|
||||
|
||||
interface SVGObject<T> {
|
||||
create: (object: T, ...a:any[]) => Element;
|
||||
update: (object: T, ...a:any[]) => void;
|
||||
}
|
||||
}
|
||||
|
||||
declare var sigma: SigmaJs.SigmaFactory;
|
||||
|
||||
Reference in New Issue
Block a user