@hpcc-js/graph 2.86.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +191 -21537
- package/dist/index.js.map +7 -1
- package/package.json +41 -58
- package/src/AdjacencyGraph.ts +3 -3
- package/src/Graph.ts +22 -20
- package/src/GraphData.ts +6 -6
- package/src/GraphLayouts.ts +203 -162
- package/src/Sankey.ts +42 -29
- package/src/Vertex.ts +2 -2
- package/src/__package__.ts +2 -2
- package/src/graph2/dataGraph.ts +109 -69
- package/src/graph2/graph.ts +12 -12
- package/src/graph2/graphReactT.ts +4 -3
- package/src/graph2/graphT.ts +26 -23
- package/src/graph2/index.ts +7 -7
- package/src/graph2/layouts/circle.ts +1 -1
- package/src/graph2/layouts/dagre.ts +3 -3
- package/src/graph2/layouts/dagreWorker.ts +4 -3
- package/src/graph2/layouts/forceDirected.ts +2 -2
- package/src/graph2/layouts/forceDirectedWorker.ts +2 -2
- package/src/graph2/layouts/graphviz.ts +3 -3
- package/src/graph2/layouts/graphvizWorker.ts +1 -1
- package/src/graph2/layouts/index.ts +7 -7
- package/src/graph2/layouts/layout.ts +2 -2
- package/src/graph2/layouts/null.ts +5 -1
- package/src/graph2/layouts/tree.ts +3 -3
- package/src/graph2/liteMap.ts +1 -1
- package/src/graph2/sankeyGraph.ts +85 -56
- package/src/graph2/subgraph.tsx +3 -3
- package/src/graph2/vertex.tsx +4 -4
- package/src/index.ts +8 -8
- package/types/AdjacencyGraph.d.ts +2 -3
- package/types/Edge.d.ts +0 -1
- package/types/Graph.d.ts +10 -10
- package/types/GraphData.d.ts +2 -3
- package/types/GraphLayouts.d.ts +45 -6
- package/types/Sankey.d.ts +27 -46
- package/types/Subgraph.d.ts +0 -1
- package/types/Vertex.d.ts +0 -1
- package/types/__package__.d.ts +2 -3
- package/types/graph2/dataGraph.d.ts +68 -34
- package/types/graph2/graph.d.ts +10 -10
- package/types/graph2/graphReactT.d.ts +3 -3
- package/types/graph2/graphT.d.ts +5 -6
- package/types/graph2/index.d.ts +7 -8
- package/types/graph2/layouts/circle.d.ts +1 -2
- package/types/graph2/layouts/dagre.d.ts +3 -4
- package/types/graph2/layouts/dagreWorker.d.ts +0 -1
- package/types/graph2/layouts/forceDirected.d.ts +2 -3
- package/types/graph2/layouts/forceDirectedWorker.d.ts +0 -1
- package/types/graph2/layouts/geoForceDirected.d.ts +0 -1
- package/types/graph2/layouts/graphviz.d.ts +2 -3
- package/types/graph2/layouts/graphvizWorker.d.ts +0 -1
- package/types/graph2/layouts/index.d.ts +7 -8
- package/types/graph2/layouts/layout.d.ts +2 -3
- package/types/graph2/layouts/null.d.ts +2 -2
- package/types/graph2/layouts/placeholders.d.ts +0 -1
- package/types/graph2/layouts/tree.d.ts +3 -4
- package/types/graph2/sankeyGraph.d.ts +54 -50
- package/types/graph2/subgraph.d.ts +2 -3
- package/types/graph2/vertex.d.ts +2 -3
- package/types/index.d.ts +8 -9
- package/dist/index.es6.js +0 -21516
- package/dist/index.es6.js.map +0 -1
- package/dist/index.min.js +0 -2
- package/dist/index.min.js.map +0 -1
- package/types/AdjacencyGraph.d.ts.map +0 -1
- package/types/Edge.d.ts.map +0 -1
- package/types/Graph.d.ts.map +0 -1
- package/types/GraphData.d.ts.map +0 -1
- package/types/GraphLayouts.d.ts.map +0 -1
- package/types/Sankey.d.ts.map +0 -1
- package/types/Subgraph.d.ts.map +0 -1
- package/types/Vertex.d.ts.map +0 -1
- package/types/__package__.d.ts.map +0 -1
- package/types/__tests__/data.d.ts +0 -9
- package/types/__tests__/data.d.ts.map +0 -1
- package/types/__tests__/index.d.ts +0 -2
- package/types/__tests__/index.d.ts.map +0 -1
- package/types/__tests__/test1.d.ts +0 -5
- package/types/__tests__/test1.d.ts.map +0 -1
- package/types/__tests__/test2.d.ts +0 -5
- package/types/__tests__/test2.d.ts.map +0 -1
- package/types/__tests__/test3.d.ts +0 -5
- package/types/__tests__/test3.d.ts.map +0 -1
- package/types/__tests__/test4.d.ts +0 -5
- package/types/__tests__/test4.d.ts.map +0 -1
- package/types/__tests__/test5.d.ts +0 -30
- package/types/__tests__/test5.d.ts.map +0 -1
- package/types/graph2/dataGraph.d.ts.map +0 -1
- package/types/graph2/graph.d.ts.map +0 -1
- package/types/graph2/graphReactT.d.ts.map +0 -1
- package/types/graph2/graphT.d.ts.map +0 -1
- package/types/graph2/index.d.ts.map +0 -1
- package/types/graph2/layouts/circle.d.ts.map +0 -1
- package/types/graph2/layouts/dagre.d.ts.map +0 -1
- package/types/graph2/layouts/dagreWorker.d.ts.map +0 -1
- package/types/graph2/layouts/forceDirected.d.ts.map +0 -1
- package/types/graph2/layouts/forceDirectedWorker.d.ts.map +0 -1
- package/types/graph2/layouts/geoForceDirected.d.ts.map +0 -1
- package/types/graph2/layouts/graphviz.d.ts.map +0 -1
- package/types/graph2/layouts/graphvizWorker.d.ts.map +0 -1
- package/types/graph2/layouts/index.d.ts.map +0 -1
- package/types/graph2/layouts/layout.d.ts.map +0 -1
- package/types/graph2/layouts/null.d.ts.map +0 -1
- package/types/graph2/layouts/placeholders.d.ts.map +0 -1
- package/types/graph2/layouts/tree.d.ts.map +0 -1
- package/types/graph2/liteMap.d.ts +0 -13
- package/types/graph2/liteMap.d.ts.map +0 -1
- package/types/graph2/liteSVGZooom.d.ts +0 -16
- package/types/graph2/liteSVGZooom.d.ts.map +0 -1
- package/types/graph2/sankeyGraph.d.ts.map +0 -1
- package/types/graph2/subgraph.d.ts.map +0 -1
- package/types/graph2/vertex.d.ts.map +0 -1
- package/types/index.d.ts.map +0 -1
- package/types/test.d.ts +0 -17
- package/types/test.d.ts.map +0 -1
- package/types-3.4/AdjacencyGraph.d.ts +0 -69
- package/types-3.4/Edge.d.ts +0 -60
- package/types-3.4/Graph.d.ts +0 -159
- package/types-3.4/GraphData.d.ts +0 -33
- package/types-3.4/GraphLayouts.d.ts +0 -6
- package/types-3.4/Sankey.d.ts +0 -72
- package/types-3.4/Subgraph.d.ts +0 -45
- package/types-3.4/Vertex.d.ts +0 -83
- package/types-3.4/__package__.d.ts +0 -4
- package/types-3.4/__tests__/data.d.ts +0 -9
- package/types-3.4/__tests__/index.d.ts +0 -2
- package/types-3.4/__tests__/test1.d.ts +0 -5
- package/types-3.4/__tests__/test2.d.ts +0 -5
- package/types-3.4/__tests__/test3.d.ts +0 -5
- package/types-3.4/__tests__/test4.d.ts +0 -5
- package/types-3.4/__tests__/test5.d.ts +0 -30
- package/types-3.4/graph2/dataGraph.d.ts +0 -66
- package/types-3.4/graph2/graph.d.ts +0 -55
- package/types-3.4/graph2/graphReactT.d.ts +0 -15
- package/types-3.4/graph2/graphT.d.ts +0 -234
- package/types-3.4/graph2/index.d.ts +0 -8
- package/types-3.4/graph2/layouts/circle.d.ts +0 -7
- package/types-3.4/graph2/layouts/dagre.d.ts +0 -13
- package/types-3.4/graph2/layouts/dagreWorker.d.ts +0 -35
- package/types-3.4/graph2/layouts/forceDirected.d.ts +0 -19
- package/types-3.4/graph2/layouts/forceDirectedWorker.d.ts +0 -32
- package/types-3.4/graph2/layouts/geoForceDirected.d.ts +0 -2
- package/types-3.4/graph2/layouts/graphviz.d.ts +0 -15
- package/types-3.4/graph2/layouts/graphvizWorker.d.ts +0 -59
- package/types-3.4/graph2/layouts/index.d.ts +0 -8
- package/types-3.4/graph2/layouts/layout.d.ts +0 -43
- package/types-3.4/graph2/layouts/null.d.ts +0 -8
- package/types-3.4/graph2/layouts/placeholders.d.ts +0 -83
- package/types-3.4/graph2/layouts/tree.d.ts +0 -51
- package/types-3.4/graph2/liteMap.d.ts +0 -16
- package/types-3.4/graph2/liteSVGZooom.d.ts +0 -16
- package/types-3.4/graph2/sankeyGraph.d.ts +0 -73
- package/types-3.4/graph2/subgraph.d.ts +0 -12
- package/types-3.4/graph2/vertex.d.ts +0 -13
- package/types-3.4/index.d.ts +0 -9
- package/types-3.4/test.d.ts +0 -17
package/src/Sankey.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Palette, PropertyExt, SVGWidget, Utility } from "@hpcc-js/common";
|
|
2
|
-
import { max as d3Max, mean as d3Mean, median as d3Median, min as d3Min, sum as d3Sum } from "d3-array";
|
|
1
|
+
import { Palette, PropertyExt, SVGWidget, Utility, max as d3Max, mean as d3Mean, median as d3Median, min as d3Min, sum as d3Sum } from "@hpcc-js/common";
|
|
3
2
|
import { sankey as d3Sankey, sankeyLinkHorizontal as d3SankeyLinkHorizontal } from "d3-sankey";
|
|
4
3
|
import { select as d3Select } from "d3-selection";
|
|
5
4
|
|
|
@@ -46,28 +45,31 @@ export class SankeyColumn extends PropertyExt {
|
|
|
46
45
|
});
|
|
47
46
|
}
|
|
48
47
|
}
|
|
49
|
-
|
|
50
|
-
column: { (): string; (_: string): SankeyColumn; };
|
|
51
|
-
aggrType: { (): string; (_: string): SankeyColumn; };
|
|
52
|
-
aggrColumn: { (): string; (_: string): SankeyColumn; };
|
|
53
|
-
|
|
54
48
|
}
|
|
55
49
|
SankeyColumn.prototype._class += " graph_Sankey.SankeyColumn";
|
|
56
50
|
|
|
57
|
-
|
|
51
|
+
export interface SankeyColumn {
|
|
52
|
+
column(): string;
|
|
53
|
+
column(_: string): this;
|
|
54
|
+
aggrType(): string;
|
|
55
|
+
aggrType(_: string): this;
|
|
56
|
+
aggrColumn(): string;
|
|
57
|
+
aggrColumn(_: string): this;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
SankeyColumn.prototype.publish("column", null, "set", "Field", function (this: SankeyColumn) { return this._owner ? this._owner.columns() : []; }, { optional: true });
|
|
58
61
|
SankeyColumn.prototype.publish("aggrType", null, "set", "Aggregation Type", [null, "mean", "median", "sum", "min", "max"], { optional: true, disable: w => !w._owner || w._owner.mappings().indexOf(w) === 0 });
|
|
59
|
-
SankeyColumn.prototype.publish("aggrColumn", null, "set", "Aggregation Field", function () { return this._owner ? this._owner.columns() : []; }, { optional: true, disable: w => !w._owner || !w.aggrType() || w._owner.mappings().indexOf(w) === 0 });
|
|
62
|
+
SankeyColumn.prototype.publish("aggrColumn", null, "set", "Aggregation Field", function (this: SankeyColumn) { return this._owner ? this._owner.columns() : []; }, { optional: true, disable: w => !w._owner || !w.aggrType() || w._owner.mappings().indexOf(w) === 0 });
|
|
60
63
|
|
|
61
64
|
export class Sankey extends SVGWidget {
|
|
62
65
|
Column;
|
|
63
|
-
_palette;
|
|
64
66
|
_d3Sankey;
|
|
65
67
|
_d3SankeyPath;
|
|
66
68
|
_selection;
|
|
67
69
|
|
|
68
70
|
constructor() {
|
|
69
71
|
super();
|
|
70
|
-
Utility.SimpleSelectionMixin.call(this);
|
|
72
|
+
Utility.SimpleSelectionMixin.call(this, false);
|
|
71
73
|
this._drawStartPos = "origin";
|
|
72
74
|
}
|
|
73
75
|
|
|
@@ -80,7 +82,7 @@ export class Sankey extends SVGWidget {
|
|
|
80
82
|
const vertexIndex = {};
|
|
81
83
|
const valueIdx = 2;
|
|
82
84
|
const mappings = this.mappings().filter(mapping => mapping.valid());
|
|
83
|
-
mappings.forEach(
|
|
85
|
+
mappings.forEach((mapping, idx) => {
|
|
84
86
|
const view = this._db.rollupView([mapping.column()]);
|
|
85
87
|
view.entries().forEach(function (row) {
|
|
86
88
|
const id = mapping.column() + ":" + idx + ":" + row.key;
|
|
@@ -95,8 +97,8 @@ export class Sankey extends SVGWidget {
|
|
|
95
97
|
vertexIndex[id] = retVal.vertices.length - 1;
|
|
96
98
|
}
|
|
97
99
|
}, this);
|
|
98
|
-
}
|
|
99
|
-
mappings.forEach(
|
|
100
|
+
});
|
|
101
|
+
mappings.forEach((mapping, idx) => {
|
|
100
102
|
if (idx < mappings.length - 1) {
|
|
101
103
|
const mapping2 = mappings[idx + 1];
|
|
102
104
|
const view = this._db.rollupView([mapping.column(), mapping2.column()]);
|
|
@@ -113,7 +115,7 @@ export class Sankey extends SVGWidget {
|
|
|
113
115
|
});
|
|
114
116
|
});
|
|
115
117
|
}
|
|
116
|
-
}
|
|
118
|
+
});
|
|
117
119
|
|
|
118
120
|
return retVal;
|
|
119
121
|
}
|
|
@@ -151,7 +153,7 @@ export class Sankey extends SVGWidget {
|
|
|
151
153
|
const link = element.selectAll(".link").data(sankeyData.edges);
|
|
152
154
|
link.enter().append("path")
|
|
153
155
|
.attr("class", "link")
|
|
154
|
-
.each(function () {
|
|
156
|
+
.each(function (this: HTMLElement) {
|
|
155
157
|
d3Select(this)
|
|
156
158
|
.append("title")
|
|
157
159
|
;
|
|
@@ -173,13 +175,13 @@ export class Sankey extends SVGWidget {
|
|
|
173
175
|
node.enter().append("g")
|
|
174
176
|
.attr("class", "node")
|
|
175
177
|
.call(this._selection.enter.bind(this._selection))
|
|
176
|
-
.on("click", function (d) {
|
|
178
|
+
.on("click", function (this: HTMLElement, d) {
|
|
177
179
|
context.click(context.rowToObj(d.origRow[0]), "", context._selection.selected(this));
|
|
178
180
|
})
|
|
179
|
-
.on("dblclick", function (d) {
|
|
181
|
+
.on("dblclick", function (this: HTMLElement, d) {
|
|
180
182
|
context.dblclick(context.rowToObj(d.origRow[0]), "", context._selection.selected(this));
|
|
181
183
|
})
|
|
182
|
-
.each(function () {
|
|
184
|
+
.each(function (this: HTMLElement) {
|
|
183
185
|
const gElement = d3Select(this);
|
|
184
186
|
gElement.append("rect");
|
|
185
187
|
gElement.append("text");
|
|
@@ -201,7 +203,7 @@ export class Sankey extends SVGWidget {
|
|
|
201
203
|
if (d.y0) _y = d.y0;
|
|
202
204
|
return "translate(" + (_x + strokeWidth) + "," + (_y + strokeWidth) + ")";
|
|
203
205
|
})
|
|
204
|
-
.each(function () {
|
|
206
|
+
.each(function (this: HTMLElement) {
|
|
205
207
|
const n = d3Select(this);
|
|
206
208
|
n.select("rect")
|
|
207
209
|
.attr("height", function (d: any) { return d.y1 - d.y0; })
|
|
@@ -255,15 +257,6 @@ export class Sankey extends SVGWidget {
|
|
|
255
257
|
*/
|
|
256
258
|
}
|
|
257
259
|
|
|
258
|
-
paletteID: { (): string; (_: string): Sankey; };
|
|
259
|
-
mappings: { (): SankeyColumn[]; (_: SankeyColumn[]): Sankey; };
|
|
260
|
-
vertexStrokeWidth: { (): number; (_: number): Sankey; };
|
|
261
|
-
vertexStrokeColor: { (): string; (_: string): Sankey; };
|
|
262
|
-
vertexWidth: { (): number; (_: number): Sankey; };
|
|
263
|
-
vertexPadding: { (): number; (_: number): Sankey; };
|
|
264
|
-
xAxisMovement: { (): boolean; (_: boolean): Sankey; };
|
|
265
|
-
yAxisMovement: { (): boolean; (_: boolean): Sankey; };
|
|
266
|
-
|
|
267
260
|
exit(domNode, element) {
|
|
268
261
|
super.exit(domNode, element);
|
|
269
262
|
}
|
|
@@ -279,6 +272,26 @@ Sankey.prototype._class += " graph_Sankey";
|
|
|
279
272
|
Sankey.prototype.Column = SankeyColumn;
|
|
280
273
|
Sankey.prototype.mixin(Utility.SimpleSelectionMixin);
|
|
281
274
|
|
|
275
|
+
export interface Sankey {
|
|
276
|
+
_palette;
|
|
277
|
+
paletteID(): string;
|
|
278
|
+
paletteID(_: string): this;
|
|
279
|
+
mappings(): SankeyColumn[];
|
|
280
|
+
mappings(_: SankeyColumn[]): this;
|
|
281
|
+
vertexStrokeWidth(): number;
|
|
282
|
+
vertexStrokeWidth(_: number): this;
|
|
283
|
+
vertexStrokeColor(): string;
|
|
284
|
+
vertexStrokeColor(_: string): this;
|
|
285
|
+
vertexWidth(): number;
|
|
286
|
+
vertexWidth(_: number): this;
|
|
287
|
+
vertexPadding(): number;
|
|
288
|
+
vertexPadding(_: number): this;
|
|
289
|
+
xAxisMovement(): boolean;
|
|
290
|
+
xAxisMovement(_: boolean): this;
|
|
291
|
+
yAxisMovement(): boolean;
|
|
292
|
+
yAxisMovement(_: boolean): this;
|
|
293
|
+
}
|
|
294
|
+
|
|
282
295
|
Sankey.prototype._palette = Palette.ordinal("default");
|
|
283
296
|
|
|
284
297
|
Sankey.prototype.publish("paletteID", "default", "set", "Color palette for this widget", Sankey.prototype._palette.switch());
|
package/src/Vertex.ts
CHANGED
|
@@ -126,7 +126,7 @@ export class Vertex extends SVGWidget {
|
|
|
126
126
|
const annotations = element.selectAll(".annotation").data(this.annotationIcons());
|
|
127
127
|
const annotationsEnter = annotations.enter().append("g")
|
|
128
128
|
.attr("class", "annotation")
|
|
129
|
-
.each(function (_d, idx) {
|
|
129
|
+
.each(function (this: HTMLElement, _d, idx) {
|
|
130
130
|
context._annotationWidgets[idx] = new Icon()
|
|
131
131
|
.target(this)
|
|
132
132
|
.shape("square")
|
|
@@ -164,7 +164,7 @@ export class Vertex extends SVGWidget {
|
|
|
164
164
|
})
|
|
165
165
|
;
|
|
166
166
|
annotations.exit()
|
|
167
|
-
.each(function (_d, idx) {
|
|
167
|
+
.each(function (this: HTMLElement, _d, idx) {
|
|
168
168
|
const element2 = d3Select(this);
|
|
169
169
|
context._annotationWidgets[idx].target(null);
|
|
170
170
|
delete context._annotationWidgets[idx];
|
package/src/__package__.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export const PKG_NAME = "@hpcc-js/graph";
|
|
2
|
-
export const PKG_VERSION = "
|
|
3
|
-
export const BUILD_VERSION = "2.
|
|
2
|
+
export const PKG_VERSION = "3.1.0";
|
|
3
|
+
export const BUILD_VERSION = "3.2.0";
|
package/src/graph2/dataGraph.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { PropertyExt,
|
|
1
|
+
import { PropertyExt, Widget } from "@hpcc-js/common";
|
|
2
2
|
import { Vertex3, CentroidVertex3, Vertex3Props, EdgeProps, SubgraphProps } from "@hpcc-js/react";
|
|
3
3
|
import { compare2 } from "@hpcc-js/util";
|
|
4
|
-
import { Graph2 } from "./graph";
|
|
5
|
-
import { HierarchyBase } from "./layouts/placeholders";
|
|
4
|
+
import { Graph2 } from "./graph.ts";
|
|
5
|
+
import { HierarchyBase } from "./layouts/placeholders.ts";
|
|
6
6
|
|
|
7
7
|
// Backward compatibility layer ---
|
|
8
8
|
export type IVertex3 = Vertex3Props;
|
|
@@ -15,11 +15,6 @@ export function toJsonObj<T>(row, columns): T {
|
|
|
15
15
|
|
|
16
16
|
export class AnnotationColumn extends PropertyExt {
|
|
17
17
|
|
|
18
|
-
@publish("", "set", "Annotation column (boolean)", function (this: AnnotationColumn) { return this._owner.vertexColumns(); })
|
|
19
|
-
columnID: publish<this, string>;
|
|
20
|
-
@publish("", "string", "Annotation ID")
|
|
21
|
-
annotationID: publish<this, string>;
|
|
22
|
-
|
|
23
18
|
protected _owner: DataGraph;
|
|
24
19
|
owner(): DataGraph;
|
|
25
20
|
owner(_: DataGraph): this;
|
|
@@ -35,69 +30,17 @@ export class AnnotationColumn extends PropertyExt {
|
|
|
35
30
|
}
|
|
36
31
|
AnnotationColumn.prototype._class += " graph_AnnotationColumn";
|
|
37
32
|
|
|
38
|
-
export
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
@publish("", "string", "Subgraph ID column")
|
|
45
|
-
subgraphIDColumn: publish<this, string>;
|
|
46
|
-
@publish("", "string", "Subgraph Label column")
|
|
47
|
-
subgraphLabelColumn: publish<this, string>;
|
|
48
|
-
|
|
49
|
-
@publish([], "any", "Vertex Columns", null, { internal: true })
|
|
50
|
-
vertexColumns: publish<this, string[]>;
|
|
51
|
-
@publish([], "any", "Vertices (Nodes)", null, { internal: true })
|
|
52
|
-
vertices: publish<this, Array<Array<string | number | boolean>>>;
|
|
53
|
-
@publish("", "set", "Vertex Category ID column", function (this: DataGraph) { return this.vertexColumns(); }, { optional: true })
|
|
54
|
-
vertexCategoryColumn: publish<this, string>;
|
|
55
|
-
@publish("", "set", "Vertex ID column", function (this: DataGraph) { return this.vertexColumns(); }, { optional: true })
|
|
56
|
-
vertexIDColumn: publish<this, string>;
|
|
57
|
-
@publish("", "set", "Vertex label column", function (this: DataGraph) { return this.vertexColumns(); }, { optional: true })
|
|
58
|
-
vertexLabelColumn: publish<this, string>;
|
|
59
|
-
@publish("", "set", "Vertex centroid column (boolean)", function (this: DataGraph) { return this.vertexColumns(); }, { optional: true })
|
|
60
|
-
vertexCentroidColumn: publish<this, string>;
|
|
61
|
-
@publish("", "string", "Vertex default image url")
|
|
62
|
-
vertexImageUrl: publish<this, string>;
|
|
63
|
-
@publish("", "set", "Vertex image url column", function (this: DataGraph) { return this.vertexColumns(); }, { optional: true })
|
|
64
|
-
vertexImageUrlColumn: publish<this, string>;
|
|
65
|
-
@publish("?", "string", "Vertex default FAChar")
|
|
66
|
-
vertexFAChar: publish<this, string>;
|
|
67
|
-
@publish("", "set", "Vertex FAChar column", function (this: DataGraph) { return this.vertexColumns(); }, { optional: true })
|
|
68
|
-
vertexFACharColumn: publish<this, string>;
|
|
69
|
-
@publish("", "set", "Vertex tooltip column", function (this: DataGraph) { return this.vertexColumns(); }, { optional: true })
|
|
70
|
-
vertexTooltipColumn: publish<this, string>;
|
|
71
|
-
@publish([], "propertyArray", "Annotations", null, { autoExpand: AnnotationColumn })
|
|
72
|
-
vertexAnnotationColumns: publish<this, AnnotationColumn[]>;
|
|
73
|
-
@publish("", "set", "Vertex expansion FAChar column", function (this: DataGraph) { return this.vertexColumns(); }, { optional: true })
|
|
74
|
-
vertexExpansionFACharColumn: publish<this, string>;
|
|
33
|
+
export interface AnnotationColumn {
|
|
34
|
+
columnID(): string;
|
|
35
|
+
columnID(_: string): this;
|
|
36
|
+
annotationID(): string;
|
|
37
|
+
annotationID(_: string): this;
|
|
38
|
+
}
|
|
75
39
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
@publish([], "any", "Edges (Edges)", null, { internal: true })
|
|
79
|
-
edges: publish<this, Array<Array<string | number | boolean>>>;
|
|
80
|
-
@publish("", "set", "Edge ID column", function (this: DataGraph) { return this.edgeColumns(); }, { optional: true })
|
|
81
|
-
edgeIDColumn: publish<this, string>;
|
|
82
|
-
@publish("", "set", "Edge label column", function (this: DataGraph) { return this.edgeColumns(); }, { optional: true })
|
|
83
|
-
edgeLabelColumn: publish<this, string>;
|
|
84
|
-
@publish("", "set", "Edge source ID column", function (this: DataGraph) { return this.edgeColumns(); }, { optional: true })
|
|
85
|
-
edgeSourceColumn: publish<this, string>;
|
|
86
|
-
@publish("", "set", "Edge target ID column", function (this: DataGraph) { return this.edgeColumns(); }, { optional: true })
|
|
87
|
-
edgeTargetColumn: publish<this, string>;
|
|
88
|
-
@publish("", "set", "Edge weight column", function (this: DataGraph) { return this.edgeColumns(); }, { optional: true })
|
|
89
|
-
edgeWeightColumn: publish<this, string>;
|
|
90
|
-
@publish("", "set", "Edge color column", function (this: DataGraph) { return this.edgeColumns(); }, { optional: true })
|
|
91
|
-
edgeColorColumn: publish<this, string>;
|
|
40
|
+
AnnotationColumn.prototype.publish("columnID", "", "set", "Annotation column (boolean)", function (this: AnnotationColumn) { return this._owner.vertexColumns(); });
|
|
41
|
+
AnnotationColumn.prototype.publish("annotationID", "", "string", "Annotation ID");
|
|
92
42
|
|
|
93
|
-
|
|
94
|
-
hierarchyColumns: publish<this, string[]>;
|
|
95
|
-
@publish([], "any", "Subgraphs")
|
|
96
|
-
hierarchy: publish<this, Array<Array<string | number | boolean>>>;
|
|
97
|
-
@publish("", "string", "Subgraph ID column")
|
|
98
|
-
hierarchyParentIDColumn: publish<this, string>;
|
|
99
|
-
@publish("", "string", "Subgraph Label column")
|
|
100
|
-
hierarchyChildIDColumn: publish<this, string>;
|
|
43
|
+
export class DataGraph extends Graph2 {
|
|
101
44
|
|
|
102
45
|
constructor() {
|
|
103
46
|
super();
|
|
@@ -303,3 +246,100 @@ export class DataGraph extends Graph2 {
|
|
|
303
246
|
}
|
|
304
247
|
}
|
|
305
248
|
DataGraph.prototype._class += " graph_DataGraph";
|
|
249
|
+
|
|
250
|
+
export interface DataGraph {
|
|
251
|
+
subgraphColumns(): string[];
|
|
252
|
+
subgraphColumns(_: string[]): this;
|
|
253
|
+
subgraphs(): Array<Array<string | number | boolean>>;
|
|
254
|
+
subgraphs(_: Array<Array<string | number | boolean>>): this;
|
|
255
|
+
subgraphIDColumn(): string;
|
|
256
|
+
subgraphIDColumn(_: string): this;
|
|
257
|
+
subgraphLabelColumn(): string;
|
|
258
|
+
subgraphLabelColumn(_: string): this;
|
|
259
|
+
|
|
260
|
+
vertexColumns(): string[];
|
|
261
|
+
vertexColumns(_: string[]): this;
|
|
262
|
+
vertices(): Array<Array<string | number | boolean>>;
|
|
263
|
+
vertices(_: Array<Array<string | number | boolean>>): this;
|
|
264
|
+
vertexCategoryColumn(): string;
|
|
265
|
+
vertexCategoryColumn(_: string): this;
|
|
266
|
+
vertexIDColumn(): string;
|
|
267
|
+
vertexIDColumn(_: string): this;
|
|
268
|
+
vertexLabelColumn(): string;
|
|
269
|
+
vertexLabelColumn(_: string): this;
|
|
270
|
+
vertexCentroidColumn(): string;
|
|
271
|
+
vertexCentroidColumn(_: string): this;
|
|
272
|
+
vertexImageUrl(): string;
|
|
273
|
+
vertexImageUrl(_: string): this;
|
|
274
|
+
vertexImageUrlColumn(): string;
|
|
275
|
+
vertexImageUrlColumn(_: string): this;
|
|
276
|
+
vertexFAChar(): string;
|
|
277
|
+
vertexFAChar(_: string): this;
|
|
278
|
+
vertexFACharColumn(): string;
|
|
279
|
+
vertexFACharColumn(_: string): this;
|
|
280
|
+
vertexTooltipColumn(): string;
|
|
281
|
+
vertexTooltipColumn(_: string): this;
|
|
282
|
+
vertexAnnotationColumns(): AnnotationColumn[];
|
|
283
|
+
vertexAnnotationColumns(_: AnnotationColumn[]): this;
|
|
284
|
+
vertexExpansionFACharColumn(): string;
|
|
285
|
+
vertexExpansionFACharColumn(_: string): this;
|
|
286
|
+
|
|
287
|
+
edgeColumns(): string[];
|
|
288
|
+
edgeColumns(_: string[]): this;
|
|
289
|
+
edges(): Array<Array<string | number | boolean>>;
|
|
290
|
+
edges(_: Array<Array<string | number | boolean>>): this;
|
|
291
|
+
edgeIDColumn(): string;
|
|
292
|
+
edgeIDColumn(_: string): this;
|
|
293
|
+
edgeLabelColumn(): string;
|
|
294
|
+
edgeLabelColumn(_: string): this;
|
|
295
|
+
edgeSourceColumn(): string;
|
|
296
|
+
edgeSourceColumn(_: string): this;
|
|
297
|
+
edgeTargetColumn(): string;
|
|
298
|
+
edgeTargetColumn(_: string): this;
|
|
299
|
+
edgeWeightColumn(): string;
|
|
300
|
+
edgeWeightColumn(_: string): this;
|
|
301
|
+
edgeColorColumn(): string;
|
|
302
|
+
edgeColorColumn(_: string): this;
|
|
303
|
+
|
|
304
|
+
hierarchyColumns(): string[];
|
|
305
|
+
hierarchyColumns(_: string[]): this;
|
|
306
|
+
hierarchy(): Array<Array<string | number | boolean>>;
|
|
307
|
+
hierarchy(_: Array<Array<string | number | boolean>>): this;
|
|
308
|
+
hierarchyParentIDColumn(): string;
|
|
309
|
+
hierarchyParentIDColumn(_: string): this;
|
|
310
|
+
hierarchyChildIDColumn(): string;
|
|
311
|
+
hierarchyChildIDColumn(_: string): this;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
DataGraph.prototype.publish("subgraphColumns", [], "any", "Subgraph Columns", null, { internal: true });
|
|
315
|
+
DataGraph.prototype.publish("subgraphs", [], "any", "Subgraphs", null, { internal: true });
|
|
316
|
+
DataGraph.prototype.publish("subgraphIDColumn", "", "string", "Subgraph ID column");
|
|
317
|
+
DataGraph.prototype.publish("subgraphLabelColumn", "", "string", "Subgraph Label column");
|
|
318
|
+
|
|
319
|
+
DataGraph.prototype.publish("vertexColumns", [], "any", "Vertex Columns", null, { internal: true });
|
|
320
|
+
DataGraph.prototype.publish("vertices", [], "any", "Vertices (Nodes)", null, { internal: true });
|
|
321
|
+
DataGraph.prototype.publish("vertexCategoryColumn", "", "set", "Vertex Category ID column", function (this: DataGraph) { return this.vertexColumns(); }, { optional: true });
|
|
322
|
+
DataGraph.prototype.publish("vertexIDColumn", "", "set", "Vertex ID column", function (this: DataGraph) { return this.vertexColumns(); }, { optional: true });
|
|
323
|
+
DataGraph.prototype.publish("vertexLabelColumn", "", "set", "Vertex label column", function (this: DataGraph) { return this.vertexColumns(); }, { optional: true });
|
|
324
|
+
DataGraph.prototype.publish("vertexCentroidColumn", "", "set", "Vertex centroid column (boolean)", function (this: DataGraph) { return this.vertexColumns(); }, { optional: true });
|
|
325
|
+
DataGraph.prototype.publish("vertexImageUrl", "", "string", "Vertex default image url");
|
|
326
|
+
DataGraph.prototype.publish("vertexImageUrlColumn", "", "set", "Vertex image url column", function (this: DataGraph) { return this.vertexColumns(); }, { optional: true });
|
|
327
|
+
DataGraph.prototype.publish("vertexFAChar", "?", "string", "Vertex default FAChar");
|
|
328
|
+
DataGraph.prototype.publish("vertexFACharColumn", "", "set", "Vertex FAChar column", function (this: DataGraph) { return this.vertexColumns(); }, { optional: true });
|
|
329
|
+
DataGraph.prototype.publish("vertexTooltipColumn", "", "set", "Vertex tooltip column", function (this: DataGraph) { return this.vertexColumns(); }, { optional: true });
|
|
330
|
+
DataGraph.prototype.publish("vertexAnnotationColumns", [], "propertyArray", "Annotations", null, { autoExpand: AnnotationColumn });
|
|
331
|
+
DataGraph.prototype.publish("vertexExpansionFACharColumn", "", "set", "Vertex expansion FAChar column", function (this: DataGraph) { return this.vertexColumns(); }, { optional: true });
|
|
332
|
+
|
|
333
|
+
DataGraph.prototype.publish("edgeColumns", [], "any", "Edge columns", null, { internal: true });
|
|
334
|
+
DataGraph.prototype.publish("edges", [], "any", "Edges (Edges)", null, { internal: true });
|
|
335
|
+
DataGraph.prototype.publish("edgeIDColumn", "", "set", "Edge ID column", function (this: DataGraph) { return this.edgeColumns(); }, { optional: true });
|
|
336
|
+
DataGraph.prototype.publish("edgeLabelColumn", "", "set", "Edge label column", function (this: DataGraph) { return this.edgeColumns(); }, { optional: true });
|
|
337
|
+
DataGraph.prototype.publish("edgeSourceColumn", "", "set", "Edge source ID column", function (this: DataGraph) { return this.edgeColumns(); }, { optional: true });
|
|
338
|
+
DataGraph.prototype.publish("edgeTargetColumn", "", "set", "Edge target ID column", function (this: DataGraph) { return this.edgeColumns(); }, { optional: true });
|
|
339
|
+
DataGraph.prototype.publish("edgeWeightColumn", "", "set", "Edge weight column", function (this: DataGraph) { return this.edgeColumns(); }, { optional: true });
|
|
340
|
+
DataGraph.prototype.publish("edgeColorColumn", "", "set", "Edge color column", function (this: DataGraph) { return this.edgeColumns(); }, { optional: true });
|
|
341
|
+
|
|
342
|
+
DataGraph.prototype.publish("hierarchyColumns", [], "any", "Subgraph Columns");
|
|
343
|
+
DataGraph.prototype.publish("hierarchy", [], "any", "Subgraphs");
|
|
344
|
+
DataGraph.prototype.publish("hierarchyParentIDColumn", "", "string", "Subgraph ID column");
|
|
345
|
+
DataGraph.prototype.publish("hierarchyChildIDColumn", "", "string", "Subgraph Label column");
|
package/src/graph2/graph.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import { GraphReactT } from "./graphReactT";
|
|
4
|
-
import { GraphDataProps, HierarchyBase } from "./graphT";
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Subgraph, SubgraphProps, Vertex, VertexProps, Edge, EdgeProps } from "@hpcc-js/react";
|
|
3
|
+
import { GraphReactT } from "./graphReactT.ts";
|
|
4
|
+
import { GraphDataProps, HierarchyBase } from "./graphT.ts";
|
|
5
5
|
|
|
6
6
|
// Backward compatibility layer ---
|
|
7
7
|
export type ISubgraph = SubgraphProps;
|
|
@@ -50,19 +50,19 @@ export class Graph2 extends GraphReactT<ISubgraph, IVertex, IEdge> {
|
|
|
50
50
|
return props;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
protected _reactVertexRenderer2: React.FunctionComponent<
|
|
54
|
-
vertexRenderer(): React.FunctionComponent<
|
|
55
|
-
vertexRenderer(_: React.FunctionComponent<
|
|
56
|
-
vertexRenderer(_?: React.FunctionComponent<
|
|
53
|
+
protected _reactVertexRenderer2: React.FunctionComponent<any>;
|
|
54
|
+
vertexRenderer<T extends VertexProps>(): React.FunctionComponent<T>;
|
|
55
|
+
vertexRenderer<T extends VertexProps>(_: React.FunctionComponent<T>): this;
|
|
56
|
+
vertexRenderer<T extends VertexProps>(_?: React.FunctionComponent<T>): this | React.FunctionComponent<T> {
|
|
57
57
|
if (!arguments.length) return this._reactVertexRenderer2;
|
|
58
58
|
this._reactVertexRenderer2 = _;
|
|
59
59
|
return this;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
protected _reactCentroidRenderer: React.FunctionComponent<
|
|
63
|
-
centroidRenderer(): React.FunctionComponent<
|
|
64
|
-
centroidRenderer(_: React.FunctionComponent<
|
|
65
|
-
centroidRenderer(_?: React.FunctionComponent<
|
|
62
|
+
protected _reactCentroidRenderer: React.FunctionComponent<any>;
|
|
63
|
+
centroidRenderer<T extends VertexProps>(): React.FunctionComponent<T>;
|
|
64
|
+
centroidRenderer<T extends VertexProps>(_: React.FunctionComponent<T>): this;
|
|
65
|
+
centroidRenderer<T extends VertexProps>(_?: React.FunctionComponent<T>): this | React.FunctionComponent<T> {
|
|
66
66
|
if (!arguments.length) return this._reactCentroidRenderer;
|
|
67
67
|
this._reactCentroidRenderer = _;
|
|
68
68
|
return this;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { SubgraphProps, VertexProps, EdgeProps, render } from "@hpcc-js/react";
|
|
3
|
+
import { GraphT, RendererT } from "./graphT.ts";
|
|
3
4
|
|
|
4
5
|
function adapter<T>(reactRenderer: React.FunctionComponent<T>): RendererT<T> {
|
|
5
6
|
return (props: T, element: SVGGElement) => render(reactRenderer, props, element);
|
|
6
7
|
}
|
|
7
8
|
|
|
8
|
-
export class GraphReactT<SG extends SubgraphProps, V extends VertexProps, E extends EdgeProps<V>> extends GraphT<SG, V, E>
|
|
9
|
+
export class GraphReactT<SG extends SubgraphProps, V extends VertexProps, E extends EdgeProps<V>> extends GraphT<SG, V, E> {
|
|
9
10
|
|
|
10
11
|
constructor(subgraphRenderer: React.FunctionComponent<SG>, vertexRenderer: React.FunctionComponent<V>, edgeRenderer: React.FunctionComponent<E>) {
|
|
11
12
|
super(adapter(subgraphRenderer), adapter(vertexRenderer), adapter(edgeRenderer));
|
package/src/graph2/graphT.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
import { d3Event, drag as d3Drag, Palette, select as d3Select, Selection, Spacer, SVGGlowFilter, SVGZoomWidget, ToggleButton, Utility, Widget, BaseType as D3BaseType } from "@hpcc-js/common";
|
|
2
2
|
import { IconEx, Icons, render } from "@hpcc-js/react";
|
|
3
3
|
import { Graph2 as GraphCollection, hashSum } from "@hpcc-js/util";
|
|
4
4
|
import { HTMLTooltip } from "@hpcc-js/html";
|
|
5
5
|
import { interpolateNumberArray as d3InterpolateNumberArray } from "d3-interpolate";
|
|
6
6
|
import "d3-transition";
|
|
7
7
|
import { interpolatePath as d3InterpolatePath } from "d3-interpolate-path";
|
|
8
|
-
import { Circle, Dagre, ForceDirected, ForceDirectedAnimated, Graphviz, ILayout, Null } from "./layouts/index";
|
|
9
|
-
import { Options as FDOptions } from "./layouts/forceDirectedWorker";
|
|
10
|
-
import type { VertexBaseProps, EdgeBaseProps, GraphDataProps, HierarchyBase, SubgraphBaseProps } from "./layouts/placeholders";
|
|
11
|
-
import { EdgePlaceholder, SubgraphPlaceholder, VertexPlaceholder, isEdgePlaceholder } from "./layouts/placeholders";
|
|
12
|
-
import { Engine, graphviz as gvWorker } from "./layouts/graphvizWorker";
|
|
13
|
-
import { Tree, RadialTree, Dendrogram, RadialDendrogram } from "./layouts/tree";
|
|
8
|
+
import { Circle, Dagre, ForceDirected, ForceDirectedAnimated, Graphviz, ILayout, Null } from "./layouts/index.ts";
|
|
9
|
+
import { Options as FDOptions } from "./layouts/forceDirectedWorker.ts";
|
|
10
|
+
import type { VertexBaseProps, EdgeBaseProps, GraphDataProps, HierarchyBase, SubgraphBaseProps } from "./layouts/placeholders.ts";
|
|
11
|
+
import { EdgePlaceholder, SubgraphPlaceholder, VertexPlaceholder, isEdgePlaceholder } from "./layouts/placeholders.ts";
|
|
12
|
+
import { Engine, graphviz as gvWorker } from "./layouts/graphvizWorker.ts";
|
|
13
|
+
import { Tree, RadialTree, Dendrogram, RadialDendrogram } from "./layouts/tree.ts";
|
|
14
14
|
|
|
15
15
|
import "../../src/graph2/graph.css";
|
|
16
16
|
|
|
@@ -32,7 +32,7 @@ function dragStart<V extends VertexBaseProps>(n: VertexPlaceholder<V>) {
|
|
|
32
32
|
n.fx = n.sx = n.x;
|
|
33
33
|
n.fy = n.sy = n.y;
|
|
34
34
|
}
|
|
35
|
-
function dragTick(n: VertexPlaceholder<
|
|
35
|
+
function dragTick<V extends VertexBaseProps>(n: VertexPlaceholder<V>, d: VertexPlaceholder<V>) {
|
|
36
36
|
n.fx = n.sx + d.fx - d.sx;
|
|
37
37
|
n.fy = n.sy + d.fy - d.sy;
|
|
38
38
|
}
|
|
@@ -88,7 +88,7 @@ export class GraphT<SG extends SubgraphBaseProps, V extends VertexBaseProps, E e
|
|
|
88
88
|
protected _tooltip: HTMLTooltip = new HTMLTooltip();
|
|
89
89
|
|
|
90
90
|
protected _selection = new Utility.Selection(this);
|
|
91
|
-
private _dragHandler = d3Drag<
|
|
91
|
+
private _dragHandler = d3Drag<SVGGElement, VertexPlaceholder<V>, SVGGElement>();
|
|
92
92
|
|
|
93
93
|
protected _catPalette = Palette.ordinal("hpcc10");
|
|
94
94
|
_svgDefs: any;
|
|
@@ -195,7 +195,7 @@ export class GraphT<SG extends SubgraphBaseProps, V extends VertexBaseProps, E e
|
|
|
195
195
|
const event = d3Event();
|
|
196
196
|
context._selection.click({
|
|
197
197
|
_id: String(d.id),
|
|
198
|
-
element: () => d.element
|
|
198
|
+
element: () => d.element as any
|
|
199
199
|
}, event.sourceEvent);
|
|
200
200
|
context.selectionChanged();
|
|
201
201
|
const selected = d.element.classed("selected");
|
|
@@ -319,7 +319,7 @@ export class GraphT<SG extends SubgraphBaseProps, V extends VertexBaseProps, E e
|
|
|
319
319
|
const vp = this._graphData.item(item.id);
|
|
320
320
|
return {
|
|
321
321
|
_id: String(vp.id),
|
|
322
|
-
element: () => vp.element
|
|
322
|
+
element: () => vp.element as any
|
|
323
323
|
};
|
|
324
324
|
}));
|
|
325
325
|
return this;
|
|
@@ -579,7 +579,7 @@ export class GraphT<SG extends SubgraphBaseProps, V extends VertexBaseProps, E e
|
|
|
579
579
|
|
|
580
580
|
moveEdgePlaceholder(ep: EdgePlaceholder<V, E>, transition: boolean): this {
|
|
581
581
|
const edgeLayout = {
|
|
582
|
-
...this._layoutAlgo.edgePath(ep, this.edgeArcDepth())
|
|
582
|
+
...this._layoutAlgo.edgePath(ep as any, this.edgeArcDepth())
|
|
583
583
|
};
|
|
584
584
|
const context = this;
|
|
585
585
|
if (this._edgeRenderer && ep.element) {
|
|
@@ -605,9 +605,11 @@ export class GraphT<SG extends SubgraphBaseProps, V extends VertexBaseProps, E e
|
|
|
605
605
|
|
|
606
606
|
moveVertexPlaceholder(vp: VertexPlaceholder<V>, transition: boolean, moveNeighbours: boolean): this {
|
|
607
607
|
const { x, y } = this.projectPlacholder(vp);
|
|
608
|
-
|
|
609
|
-
.
|
|
610
|
-
|
|
608
|
+
if (vp.element) {
|
|
609
|
+
(transition ? vp.element.transition().duration(this.transitionDuration()) as unknown as Selection<SVGPathElement, EdgePlaceholder<V, E>, SVGGElement, any> : vp.element)
|
|
610
|
+
.attr("transform", `translate(${x} ${y})`)
|
|
611
|
+
;
|
|
612
|
+
}
|
|
611
613
|
if (moveNeighbours) {
|
|
612
614
|
this._graphData.vertexEdges(vp.id).forEach(e => this.moveEdgePlaceholder(e, transition));
|
|
613
615
|
}
|
|
@@ -695,14 +697,14 @@ export class GraphT<SG extends SubgraphBaseProps, V extends VertexBaseProps, E e
|
|
|
695
697
|
updateEdges(): this {
|
|
696
698
|
const context = this;
|
|
697
699
|
this._edgeG.selectAll(".graphEdge")
|
|
698
|
-
.data(this._graphData.allEdges(), (d
|
|
700
|
+
.data(this._graphData.allEdges(), d => (d as EdgePlaceholder<V, E>).id)
|
|
699
701
|
.join(
|
|
700
702
|
enter => enter.append("g")
|
|
701
703
|
.attr("class", "graphEdge")
|
|
702
704
|
.on("click.selectionBag", function (d) {
|
|
703
705
|
context._selection.click({
|
|
704
706
|
_id: String(d.id),
|
|
705
|
-
element: () => d.element
|
|
707
|
+
element: () => d.element as any
|
|
706
708
|
}, d3Event());
|
|
707
709
|
context.selectionChanged();
|
|
708
710
|
})
|
|
@@ -761,7 +763,7 @@ export class GraphT<SG extends SubgraphBaseProps, V extends VertexBaseProps, E e
|
|
|
761
763
|
updateVertices(): this {
|
|
762
764
|
const context = this;
|
|
763
765
|
this._vertexG.selectAll(".graphVertex")
|
|
764
|
-
.data(this._graphData.allVertices(), (d
|
|
766
|
+
.data(this._graphData.allVertices(), d => (d as VertexPlaceholder<V>).id)
|
|
765
767
|
.join(
|
|
766
768
|
enter => enter.append("g")
|
|
767
769
|
.attr("class", "graphVertex")
|
|
@@ -808,7 +810,7 @@ export class GraphT<SG extends SubgraphBaseProps, V extends VertexBaseProps, E e
|
|
|
808
810
|
context._tooltip.mouseout();
|
|
809
811
|
}
|
|
810
812
|
})
|
|
811
|
-
.call(this._dragHandler)
|
|
813
|
+
.call((sel) => this._dragHandler(sel))
|
|
812
814
|
.each(function (d) {
|
|
813
815
|
d.element = d3Select(this);
|
|
814
816
|
}),
|
|
@@ -822,7 +824,7 @@ export class GraphT<SG extends SubgraphBaseProps, V extends VertexBaseProps, E e
|
|
|
822
824
|
.classed("centroid", d => d.props.centroid)
|
|
823
825
|
.attr("opacity", d => d.props.hidden ? 0 : 1)
|
|
824
826
|
.attr("filter", d => d.props.centroid ? "url(#" + this.id() + "_glow)" : null)
|
|
825
|
-
.each(function (this:
|
|
827
|
+
.each(function (this: any, d) {
|
|
826
828
|
const props = context.calcProps(
|
|
827
829
|
{
|
|
828
830
|
showLabel: context.showVertexLabels(),
|
|
@@ -860,14 +862,14 @@ export class GraphT<SG extends SubgraphBaseProps, V extends VertexBaseProps, E e
|
|
|
860
862
|
updateSubgraphs(): this {
|
|
861
863
|
const context = this;
|
|
862
864
|
this._subgraphG.selectAll(".subgraphPlaceholder")
|
|
863
|
-
.data(this.hasSubgraphs() ? this._graphData.allSubgraphs() : [], (d
|
|
865
|
+
.data(this.hasSubgraphs() ? this._graphData.allSubgraphs() : [], d => (d as SubgraphPlaceholder<SG>).id)
|
|
864
866
|
.join(
|
|
865
867
|
enter => enter.append("g")
|
|
866
868
|
.attr("class", "subgraphPlaceholder")
|
|
867
869
|
.on("click.selectionBag", function (d) {
|
|
868
870
|
context._selection.click({
|
|
869
871
|
_id: String(d.id),
|
|
870
|
-
element: () => d.element
|
|
872
|
+
element: () => d.element as any
|
|
871
873
|
}, d3Event());
|
|
872
874
|
context.selectionChanged();
|
|
873
875
|
})
|
|
@@ -1310,8 +1312,9 @@ GraphT.prototype.publish("treeRankDirection", "LR", "set", "Direction for Rank N
|
|
|
1310
1312
|
GraphT.prototype.publish("wasmFolder", null, "string", "WASM Folder", null, { optional: true, disable: (w: GraphT) => ["DOT", "Neato", "FDP", "TwoPI", "Circo"].indexOf(w.layout()) < 0 });
|
|
1311
1313
|
|
|
1312
1314
|
const _origScale = GraphT.prototype.scale;
|
|
1315
|
+
// @ts-ignore ---
|
|
1313
1316
|
GraphT.prototype.scale = function (_?, transitionDuration?) {
|
|
1314
|
-
const retVal = _origScale.apply(this, arguments);
|
|
1317
|
+
const retVal = _origScale.apply(this, arguments as any);
|
|
1315
1318
|
if (arguments.length) {
|
|
1316
1319
|
this.zoomTo(_, transitionDuration);
|
|
1317
1320
|
}
|
package/src/graph2/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export * from "./graphT";
|
|
2
|
-
export * from "./graphReactT";
|
|
3
|
-
export * from "./graph";
|
|
4
|
-
export * from "./dataGraph";
|
|
5
|
-
export * from "./sankeyGraph";
|
|
6
|
-
export * from "./subgraph";
|
|
7
|
-
export * from "./vertex";
|
|
1
|
+
export * from "./graphT.ts";
|
|
2
|
+
export * from "./graphReactT.ts";
|
|
3
|
+
export * from "./graph.ts";
|
|
4
|
+
export * from "./dataGraph.ts";
|
|
5
|
+
export * from "./sankeyGraph.ts";
|
|
6
|
+
export * from "./subgraph.tsx";
|
|
7
|
+
export * from "./vertex.tsx";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { curveBasis as d3CurveBasis, line as d3Line } from "d3-shape";
|
|
2
|
-
import { dagre, Options } from "./dagreWorker";
|
|
3
|
-
import { Layout, Point } from "./layout";
|
|
4
|
-
import { EdgePlaceholder } from "./placeholders";
|
|
2
|
+
import { dagre, Options } from "./dagreWorker.ts";
|
|
3
|
+
import { Layout, Point } from "./layout.ts";
|
|
4
|
+
import { EdgePlaceholder } from "./placeholders.ts";
|
|
5
5
|
|
|
6
6
|
const lineBasis = d3Line<Point>()
|
|
7
7
|
.x(d => d[0])
|