@hpcc-js/graph 2.87.2 → 2.87.3
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/LICENSE +43 -43
- package/README.md +256 -256
- package/dist/index.es6.js +7 -7
- package/dist/index.es6.js.map +1 -1
- package/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +8 -8
- package/src/AdjacencyGraph.ts +224 -224
- package/src/Edge.css +23 -23
- package/src/Edge.ts +257 -257
- package/src/Graph.css +18 -18
- package/src/Graph.ts +1075 -1075
- package/src/GraphData.ts +187 -187
- package/src/GraphLayouts.ts +173 -173
- package/src/Sankey.css +46 -46
- package/src/Sankey.ts +291 -291
- package/src/Subgraph.css +10 -10
- package/src/Subgraph.ts +165 -165
- package/src/Vertex.css +3 -3
- package/src/Vertex.ts +282 -282
- package/src/__package__.ts +3 -3
- package/src/__tests__/data.ts +444 -444
- package/src/__tests__/index.ts +1 -1
- package/src/__tests__/test1.ts +18 -18
- package/src/__tests__/test2.ts +80 -80
- package/src/__tests__/test3.ts +46 -46
- package/src/__tests__/test4.ts +66 -66
- package/src/__tests__/test5.ts +85 -85
- package/src/graph2/dataGraph.ts +305 -305
- package/src/graph2/graph.css +34 -34
- package/src/graph2/graph.ts +135 -135
- package/src/graph2/graphReactT.ts +44 -44
- package/src/graph2/graphT.ts +1330 -1330
- package/src/graph2/index.ts +7 -7
- package/src/graph2/layouts/circle.ts +37 -37
- package/src/graph2/layouts/dagre.ts +132 -132
- package/src/graph2/layouts/dagreWorker.ts +35 -35
- package/src/graph2/layouts/forceDirected.ts +117 -117
- package/src/graph2/layouts/forceDirectedWorker.ts +30 -30
- package/src/graph2/layouts/geoForceDirected.ts +112 -112
- package/src/graph2/layouts/graphviz.ts +124 -124
- package/src/graph2/layouts/graphvizWorker.ts +71 -71
- package/src/graph2/layouts/index.ts +7 -7
- package/src/graph2/layouts/layout.ts +105 -105
- package/src/graph2/layouts/null.ts +35 -35
- package/src/graph2/layouts/placeholders.ts +103 -103
- package/src/graph2/layouts/tree.ts +328 -328
- package/src/graph2/liteMap.ts +72 -72
- package/src/graph2/liteSVGZooom.ts +61 -61
- package/src/graph2/sankeyGraph.css +45 -45
- package/src/graph2/sankeyGraph.ts +316 -316
- package/src/graph2/subgraph.tsx +30 -30
- package/src/graph2/vertex.tsx +31 -31
- package/src/index.ts +8 -8
- package/src/test.ts +649 -649
package/src/graph2/graph.css
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
.graph_Graph2 .graphVertex {
|
|
2
|
-
cursor: pointer;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
.graph_Graph2 .allowDragging .graphVertex {
|
|
7
|
-
cursor: pointer;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.graph_Graph2 .allowDragging .graphVertex.grabbed {
|
|
11
|
-
cursor: grabbing;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.graph_Graph2 .graphEdge {
|
|
15
|
-
stroke: darkgray;
|
|
16
|
-
fill: none;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.graph_Graph2 .graphEdge > text {
|
|
20
|
-
stroke: none;
|
|
21
|
-
fill: black;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.graph_Graph2 .graphEdge.hide-text > text {
|
|
25
|
-
display: none;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.graph_Graph2 g.selected rect {
|
|
29
|
-
stroke:red !important;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.graph_Graph2 g.selected circle {
|
|
33
|
-
stroke:red !important;
|
|
34
|
-
}
|
|
1
|
+
.graph_Graph2 .graphVertex {
|
|
2
|
+
cursor: pointer;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
.graph_Graph2 .allowDragging .graphVertex {
|
|
7
|
+
cursor: pointer;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.graph_Graph2 .allowDragging .graphVertex.grabbed {
|
|
11
|
+
cursor: grabbing;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.graph_Graph2 .graphEdge {
|
|
15
|
+
stroke: darkgray;
|
|
16
|
+
fill: none;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.graph_Graph2 .graphEdge > text {
|
|
20
|
+
stroke: none;
|
|
21
|
+
fill: black;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.graph_Graph2 .graphEdge.hide-text > text {
|
|
25
|
+
display: none;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.graph_Graph2 g.selected rect {
|
|
29
|
+
stroke:red !important;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.graph_Graph2 g.selected circle {
|
|
33
|
+
stroke:red !important;
|
|
34
|
+
}
|
package/src/graph2/graph.ts
CHANGED
|
@@ -1,135 +1,135 @@
|
|
|
1
|
-
import { React, Subgraph, SubgraphProps, Vertex, VertexProps, Edge, EdgeProps } from "@hpcc-js/react";
|
|
2
|
-
// import { IVertexEdgeProps, VertexEdge } from "./edge";
|
|
3
|
-
import { GraphReactT } from "./graphReactT";
|
|
4
|
-
import { GraphDataProps, HierarchyBase } from "./graphT";
|
|
5
|
-
|
|
6
|
-
// Backward compatibility layer ---
|
|
7
|
-
export type ISubgraph = SubgraphProps;
|
|
8
|
-
export type IVertex = VertexProps;
|
|
9
|
-
export type IEdge = EdgeProps;
|
|
10
|
-
export type IHierarchy = HierarchyBase<ISubgraph, IVertex>;
|
|
11
|
-
export type IGraphData2 = GraphDataProps<ISubgraph, IVertex, IEdge>;
|
|
12
|
-
|
|
13
|
-
export class Graph2 extends GraphReactT<ISubgraph, IVertex, IEdge> {
|
|
14
|
-
|
|
15
|
-
constructor() {
|
|
16
|
-
super(Subgraph, Vertex, Edge);
|
|
17
|
-
this._reactCentroidRenderer = Vertex;
|
|
18
|
-
this._reactVertexRenderer2 = Vertex;
|
|
19
|
-
super.vertexRenderer((props) => {
|
|
20
|
-
return props.centroid ? this._reactCentroidRenderer(props) : this._reactVertexRenderer2(props);
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
calcProps(_props: VertexProps): VertexProps {
|
|
25
|
-
const props = super.calcProps(_props);
|
|
26
|
-
if (!props.icon) props.icon = {};
|
|
27
|
-
if (props.centroid) {
|
|
28
|
-
props.textHeight = props.textHeight ? props.textHeight : this.centroidTextHeight() * this.centroidScale();
|
|
29
|
-
props.textPadding = props.textPadding ? props.textPadding : this.centroidTextPadding() * this.centroidScale();
|
|
30
|
-
props.textFontFamily = props.textFontFamily ? props.textFontFamily : this.centroidLabelFontFamily();
|
|
31
|
-
props.icon.height = props.icon.height ? props.icon.height : this.centroidIconHeight() * this.centroidScale();
|
|
32
|
-
props.icon.padding = props.icon.padding ? props.icon.padding : this.centroidIconPadding() * this.centroidScale();
|
|
33
|
-
props.icon.strokeWidth = props.icon.strokeWidth ? props.icon.strokeWidth : this.centroidIconStrokeWidth();
|
|
34
|
-
props.icon.imageFontFamily = props.icon.imageFontFamily ? props.icon.imageFontFamily : this.centroidIconFontFamily();
|
|
35
|
-
} else {
|
|
36
|
-
props.textHeight = props.textHeight ? props.textHeight : this.vertexTextHeight();
|
|
37
|
-
props.textPadding = props.textPadding ? props.textPadding : this.vertexTextPadding();
|
|
38
|
-
props.textFontFamily = props.textFontFamily ? props.textFontFamily : this.vertexLabelFontFamily();
|
|
39
|
-
props.icon.height = props.icon.height ? props.icon.height : this.vertexIconHeight();
|
|
40
|
-
props.icon.padding = props.icon.padding ? props.icon.padding : this.vertexIconPadding();
|
|
41
|
-
props.icon.strokeWidth = props.icon.strokeWidth ? props.icon.strokeWidth : this.vertexIconStrokeWidth();
|
|
42
|
-
props.icon.imageFontFamily = props.icon.imageFontFamily ? props.icon.imageFontFamily : this.vertexIconFontFamily();
|
|
43
|
-
}
|
|
44
|
-
const text = props.icon.imageChar;
|
|
45
|
-
const fontFamily = props.icon.imageFontFamily;
|
|
46
|
-
const fontSize = props.icon.height - props.icon.padding;
|
|
47
|
-
const rect = this.textRect(text, fontFamily, fontSize);
|
|
48
|
-
|
|
49
|
-
props.icon.yOffset = -(rect.top - (fontSize / 2)) - (rect.height / 2) + (props.icon.padding > 0 ? fontSize / props.icon.padding / 2 : 0);
|
|
50
|
-
return props;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
protected _reactVertexRenderer2: React.FunctionComponent<VertexProps>;
|
|
54
|
-
vertexRenderer(): React.FunctionComponent<VertexProps>;
|
|
55
|
-
vertexRenderer(_: React.FunctionComponent<VertexProps>): this;
|
|
56
|
-
vertexRenderer(_?: React.FunctionComponent<VertexProps>): this | React.FunctionComponent<VertexProps> {
|
|
57
|
-
if (!arguments.length) return this._reactVertexRenderer2;
|
|
58
|
-
this._reactVertexRenderer2 = _;
|
|
59
|
-
return this;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
protected _reactCentroidRenderer: React.FunctionComponent<VertexProps>;
|
|
63
|
-
centroidRenderer(): React.FunctionComponent<VertexProps>;
|
|
64
|
-
centroidRenderer(_: React.FunctionComponent<VertexProps>): this;
|
|
65
|
-
centroidRenderer(_?: React.FunctionComponent<VertexProps>): this | React.FunctionComponent<VertexProps> {
|
|
66
|
-
if (!arguments.length) return this._reactCentroidRenderer;
|
|
67
|
-
this._reactCentroidRenderer = _;
|
|
68
|
-
return this;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
enter(domNode, element) {
|
|
72
|
-
super.enter(domNode, element);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
update(domNode, element) {
|
|
76
|
-
super.update(domNode, element);
|
|
77
|
-
this._centroidFilter.update(this.centroidColor());
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
Graph2.prototype._class += " graph_Graph2";
|
|
81
|
-
|
|
82
|
-
export interface Graph2 {
|
|
83
|
-
vertexTextHeight(): number;
|
|
84
|
-
vertexTextHeight(_: number): this;
|
|
85
|
-
vertexTextPadding(): number;
|
|
86
|
-
vertexTextPadding(_: number): this;
|
|
87
|
-
vertexIconHeight(): number;
|
|
88
|
-
vertexIconHeight(_: number): this;
|
|
89
|
-
vertexIconPadding(): number;
|
|
90
|
-
vertexIconPadding(_: number): this;
|
|
91
|
-
vertexIconStrokeWidth(): number;
|
|
92
|
-
vertexIconStrokeWidth(_: number): this;
|
|
93
|
-
vertexIconFontFamily(): string;
|
|
94
|
-
vertexIconFontFamily(_: string): this;
|
|
95
|
-
vertexLabelFontFamily(): string;
|
|
96
|
-
vertexLabelFontFamily(_: string): this;
|
|
97
|
-
|
|
98
|
-
centroidColor(): string;
|
|
99
|
-
centroidColor(_: string): this;
|
|
100
|
-
centroidScale(): number;
|
|
101
|
-
centroidScale(_: number): this;
|
|
102
|
-
centroidTextHeight(): number;
|
|
103
|
-
centroidTextHeight(_: number): this;
|
|
104
|
-
centroidTextPadding(): number;
|
|
105
|
-
centroidTextPadding(_: number): this;
|
|
106
|
-
centroidIconHeight(): number;
|
|
107
|
-
centroidIconHeight(_: number): this;
|
|
108
|
-
centroidIconPadding(): number;
|
|
109
|
-
centroidIconPadding(_: number): this;
|
|
110
|
-
centroidIconStrokeWidth(): number;
|
|
111
|
-
centroidIconStrokeWidth(_: number): this;
|
|
112
|
-
centroidIconFontFamily(): string;
|
|
113
|
-
centroidIconFontFamily(_: string): this;
|
|
114
|
-
centroidLabelFontFamily(): string;
|
|
115
|
-
centroidLabelFontFamily(_: string): this;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
Graph2.prototype.publish("vertexTextHeight", 10, "number", "Vertex Text Height");
|
|
119
|
-
Graph2.prototype.publish("vertexTextPadding", 4, "number", "Vertex Text Padding");
|
|
120
|
-
Graph2.prototype.publish("vertexIconHeight", 50, "number", "Vertex Icon Height");
|
|
121
|
-
Graph2.prototype.publish("vertexIconPadding", 10, "number", "Vertex Icon Padding");
|
|
122
|
-
Graph2.prototype.publish("vertexIconStrokeWidth", 0, "number", "Vertex Icon Stroke Width");
|
|
123
|
-
Graph2.prototype.publish("vertexIconFontFamily", "FontAwesome", "string", "Vertex Icon Font Family");
|
|
124
|
-
Graph2.prototype.publish("vertexLabelFontFamily", "Verdana", "string", "Vertex Label Font Family");
|
|
125
|
-
|
|
126
|
-
Graph2.prototype.publish("centroidColor", "#00A000", "html-color", "Centroid Glow Color");
|
|
127
|
-
Graph2.prototype.publish("centroidScale", 1, "number", "Centroid Scale");
|
|
128
|
-
Graph2.prototype.publish("centroidTextHeight", 12, "number", "Centroid Text Height");
|
|
129
|
-
Graph2.prototype.publish("centroidTextPadding", 4, "number", "Centroid Text Padding");
|
|
130
|
-
Graph2.prototype.publish("centroidIconHeight", 50, "number", "Centroid Icon Height");
|
|
131
|
-
Graph2.prototype.publish("centroidIconPadding", 10, "number", "Centroid Icon Padding");
|
|
132
|
-
Graph2.prototype.publish("centroidIconStrokeWidth", 4, "number", "Centroid Icon Stroke Width");
|
|
133
|
-
Graph2.prototype.publish("centroidIconFontFamily", "FontAwesome", "string", "Centroid Icon Font Family");
|
|
134
|
-
Graph2.prototype.publish("centroidLabelFontFamily", "Verdana", "string", "Centroid Label Font Family");
|
|
135
|
-
|
|
1
|
+
import { React, Subgraph, SubgraphProps, Vertex, VertexProps, Edge, EdgeProps } from "@hpcc-js/react";
|
|
2
|
+
// import { IVertexEdgeProps, VertexEdge } from "./edge";
|
|
3
|
+
import { GraphReactT } from "./graphReactT";
|
|
4
|
+
import { GraphDataProps, HierarchyBase } from "./graphT";
|
|
5
|
+
|
|
6
|
+
// Backward compatibility layer ---
|
|
7
|
+
export type ISubgraph = SubgraphProps;
|
|
8
|
+
export type IVertex = VertexProps;
|
|
9
|
+
export type IEdge = EdgeProps;
|
|
10
|
+
export type IHierarchy = HierarchyBase<ISubgraph, IVertex>;
|
|
11
|
+
export type IGraphData2 = GraphDataProps<ISubgraph, IVertex, IEdge>;
|
|
12
|
+
|
|
13
|
+
export class Graph2 extends GraphReactT<ISubgraph, IVertex, IEdge> {
|
|
14
|
+
|
|
15
|
+
constructor() {
|
|
16
|
+
super(Subgraph, Vertex, Edge);
|
|
17
|
+
this._reactCentroidRenderer = Vertex;
|
|
18
|
+
this._reactVertexRenderer2 = Vertex;
|
|
19
|
+
super.vertexRenderer((props) => {
|
|
20
|
+
return props.centroid ? this._reactCentroidRenderer(props) : this._reactVertexRenderer2(props);
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
calcProps(_props: VertexProps): VertexProps {
|
|
25
|
+
const props = super.calcProps(_props);
|
|
26
|
+
if (!props.icon) props.icon = {};
|
|
27
|
+
if (props.centroid) {
|
|
28
|
+
props.textHeight = props.textHeight ? props.textHeight : this.centroidTextHeight() * this.centroidScale();
|
|
29
|
+
props.textPadding = props.textPadding ? props.textPadding : this.centroidTextPadding() * this.centroidScale();
|
|
30
|
+
props.textFontFamily = props.textFontFamily ? props.textFontFamily : this.centroidLabelFontFamily();
|
|
31
|
+
props.icon.height = props.icon.height ? props.icon.height : this.centroidIconHeight() * this.centroidScale();
|
|
32
|
+
props.icon.padding = props.icon.padding ? props.icon.padding : this.centroidIconPadding() * this.centroidScale();
|
|
33
|
+
props.icon.strokeWidth = props.icon.strokeWidth ? props.icon.strokeWidth : this.centroidIconStrokeWidth();
|
|
34
|
+
props.icon.imageFontFamily = props.icon.imageFontFamily ? props.icon.imageFontFamily : this.centroidIconFontFamily();
|
|
35
|
+
} else {
|
|
36
|
+
props.textHeight = props.textHeight ? props.textHeight : this.vertexTextHeight();
|
|
37
|
+
props.textPadding = props.textPadding ? props.textPadding : this.vertexTextPadding();
|
|
38
|
+
props.textFontFamily = props.textFontFamily ? props.textFontFamily : this.vertexLabelFontFamily();
|
|
39
|
+
props.icon.height = props.icon.height ? props.icon.height : this.vertexIconHeight();
|
|
40
|
+
props.icon.padding = props.icon.padding ? props.icon.padding : this.vertexIconPadding();
|
|
41
|
+
props.icon.strokeWidth = props.icon.strokeWidth ? props.icon.strokeWidth : this.vertexIconStrokeWidth();
|
|
42
|
+
props.icon.imageFontFamily = props.icon.imageFontFamily ? props.icon.imageFontFamily : this.vertexIconFontFamily();
|
|
43
|
+
}
|
|
44
|
+
const text = props.icon.imageChar;
|
|
45
|
+
const fontFamily = props.icon.imageFontFamily;
|
|
46
|
+
const fontSize = props.icon.height - props.icon.padding;
|
|
47
|
+
const rect = this.textRect(text, fontFamily, fontSize);
|
|
48
|
+
|
|
49
|
+
props.icon.yOffset = -(rect.top - (fontSize / 2)) - (rect.height / 2) + (props.icon.padding > 0 ? fontSize / props.icon.padding / 2 : 0);
|
|
50
|
+
return props;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
protected _reactVertexRenderer2: React.FunctionComponent<VertexProps>;
|
|
54
|
+
vertexRenderer(): React.FunctionComponent<VertexProps>;
|
|
55
|
+
vertexRenderer(_: React.FunctionComponent<VertexProps>): this;
|
|
56
|
+
vertexRenderer(_?: React.FunctionComponent<VertexProps>): this | React.FunctionComponent<VertexProps> {
|
|
57
|
+
if (!arguments.length) return this._reactVertexRenderer2;
|
|
58
|
+
this._reactVertexRenderer2 = _;
|
|
59
|
+
return this;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
protected _reactCentroidRenderer: React.FunctionComponent<VertexProps>;
|
|
63
|
+
centroidRenderer(): React.FunctionComponent<VertexProps>;
|
|
64
|
+
centroidRenderer(_: React.FunctionComponent<VertexProps>): this;
|
|
65
|
+
centroidRenderer(_?: React.FunctionComponent<VertexProps>): this | React.FunctionComponent<VertexProps> {
|
|
66
|
+
if (!arguments.length) return this._reactCentroidRenderer;
|
|
67
|
+
this._reactCentroidRenderer = _;
|
|
68
|
+
return this;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
enter(domNode, element) {
|
|
72
|
+
super.enter(domNode, element);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
update(domNode, element) {
|
|
76
|
+
super.update(domNode, element);
|
|
77
|
+
this._centroidFilter.update(this.centroidColor());
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
Graph2.prototype._class += " graph_Graph2";
|
|
81
|
+
|
|
82
|
+
export interface Graph2 {
|
|
83
|
+
vertexTextHeight(): number;
|
|
84
|
+
vertexTextHeight(_: number): this;
|
|
85
|
+
vertexTextPadding(): number;
|
|
86
|
+
vertexTextPadding(_: number): this;
|
|
87
|
+
vertexIconHeight(): number;
|
|
88
|
+
vertexIconHeight(_: number): this;
|
|
89
|
+
vertexIconPadding(): number;
|
|
90
|
+
vertexIconPadding(_: number): this;
|
|
91
|
+
vertexIconStrokeWidth(): number;
|
|
92
|
+
vertexIconStrokeWidth(_: number): this;
|
|
93
|
+
vertexIconFontFamily(): string;
|
|
94
|
+
vertexIconFontFamily(_: string): this;
|
|
95
|
+
vertexLabelFontFamily(): string;
|
|
96
|
+
vertexLabelFontFamily(_: string): this;
|
|
97
|
+
|
|
98
|
+
centroidColor(): string;
|
|
99
|
+
centroidColor(_: string): this;
|
|
100
|
+
centroidScale(): number;
|
|
101
|
+
centroidScale(_: number): this;
|
|
102
|
+
centroidTextHeight(): number;
|
|
103
|
+
centroidTextHeight(_: number): this;
|
|
104
|
+
centroidTextPadding(): number;
|
|
105
|
+
centroidTextPadding(_: number): this;
|
|
106
|
+
centroidIconHeight(): number;
|
|
107
|
+
centroidIconHeight(_: number): this;
|
|
108
|
+
centroidIconPadding(): number;
|
|
109
|
+
centroidIconPadding(_: number): this;
|
|
110
|
+
centroidIconStrokeWidth(): number;
|
|
111
|
+
centroidIconStrokeWidth(_: number): this;
|
|
112
|
+
centroidIconFontFamily(): string;
|
|
113
|
+
centroidIconFontFamily(_: string): this;
|
|
114
|
+
centroidLabelFontFamily(): string;
|
|
115
|
+
centroidLabelFontFamily(_: string): this;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
Graph2.prototype.publish("vertexTextHeight", 10, "number", "Vertex Text Height");
|
|
119
|
+
Graph2.prototype.publish("vertexTextPadding", 4, "number", "Vertex Text Padding");
|
|
120
|
+
Graph2.prototype.publish("vertexIconHeight", 50, "number", "Vertex Icon Height");
|
|
121
|
+
Graph2.prototype.publish("vertexIconPadding", 10, "number", "Vertex Icon Padding");
|
|
122
|
+
Graph2.prototype.publish("vertexIconStrokeWidth", 0, "number", "Vertex Icon Stroke Width");
|
|
123
|
+
Graph2.prototype.publish("vertexIconFontFamily", "FontAwesome", "string", "Vertex Icon Font Family");
|
|
124
|
+
Graph2.prototype.publish("vertexLabelFontFamily", "Verdana", "string", "Vertex Label Font Family");
|
|
125
|
+
|
|
126
|
+
Graph2.prototype.publish("centroidColor", "#00A000", "html-color", "Centroid Glow Color");
|
|
127
|
+
Graph2.prototype.publish("centroidScale", 1, "number", "Centroid Scale");
|
|
128
|
+
Graph2.prototype.publish("centroidTextHeight", 12, "number", "Centroid Text Height");
|
|
129
|
+
Graph2.prototype.publish("centroidTextPadding", 4, "number", "Centroid Text Padding");
|
|
130
|
+
Graph2.prototype.publish("centroidIconHeight", 50, "number", "Centroid Icon Height");
|
|
131
|
+
Graph2.prototype.publish("centroidIconPadding", 10, "number", "Centroid Icon Padding");
|
|
132
|
+
Graph2.prototype.publish("centroidIconStrokeWidth", 4, "number", "Centroid Icon Stroke Width");
|
|
133
|
+
Graph2.prototype.publish("centroidIconFontFamily", "FontAwesome", "string", "Centroid Icon Font Family");
|
|
134
|
+
Graph2.prototype.publish("centroidLabelFontFamily", "Verdana", "string", "Centroid Label Font Family");
|
|
135
|
+
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
import { render, React, SubgraphProps, VertexProps, EdgeProps } from "@hpcc-js/react";
|
|
2
|
-
import { GraphT, RendererT } from "./graphT";
|
|
3
|
-
|
|
4
|
-
function adapter<T>(reactRenderer: React.FunctionComponent<T>): RendererT<T> {
|
|
5
|
-
return (props: T, element: SVGGElement) => render(reactRenderer, props, element);
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export class GraphReactT<SG extends SubgraphProps, V extends VertexProps, E extends EdgeProps<V>> extends GraphT<SG, V, E> {
|
|
9
|
-
|
|
10
|
-
constructor(subgraphRenderer: React.FunctionComponent<SG>, vertexRenderer: React.FunctionComponent<V>, edgeRenderer: React.FunctionComponent<E>) {
|
|
11
|
-
super(adapter(subgraphRenderer), adapter(vertexRenderer), adapter(edgeRenderer));
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
private _reactSubgraphRenderer: React.FunctionComponent<SG>;
|
|
15
|
-
subgraphRenderer(): React.FunctionComponent<SG>;
|
|
16
|
-
subgraphRenderer(_: React.FunctionComponent<SG>): this;
|
|
17
|
-
subgraphRenderer(_?: React.FunctionComponent<SG>): this | React.FunctionComponent<SG> {
|
|
18
|
-
if (!arguments.length) return this._reactSubgraphRenderer;
|
|
19
|
-
this._reactSubgraphRenderer = _;
|
|
20
|
-
super.subgraphRenderer(adapter(this._reactSubgraphRenderer));
|
|
21
|
-
return this;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
private _reactVertexRenderer: React.FunctionComponent<V>;
|
|
25
|
-
vertexRenderer(): React.FunctionComponent<V>;
|
|
26
|
-
vertexRenderer(_: React.FunctionComponent<V>): this;
|
|
27
|
-
vertexRenderer(_?: React.FunctionComponent<V>): this | React.FunctionComponent<V> {
|
|
28
|
-
if (!arguments.length) return this._reactVertexRenderer;
|
|
29
|
-
this._reactVertexRenderer = _;
|
|
30
|
-
super.vertexRenderer((props: V, element: SVGGElement) => render(this._reactVertexRenderer, props, element));
|
|
31
|
-
return this;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
private _reactEdgeRenderer: React.FunctionComponent<E>;
|
|
35
|
-
edgeRenderer(): React.FunctionComponent<E>;
|
|
36
|
-
edgeRenderer(_: React.FunctionComponent<E>): this;
|
|
37
|
-
edgeRenderer(_?: React.FunctionComponent<E>): this | React.FunctionComponent<E> {
|
|
38
|
-
if (!arguments.length) return this._reactEdgeRenderer;
|
|
39
|
-
this._reactEdgeRenderer = _;
|
|
40
|
-
super.edgeRenderer((props: E, element: SVGGElement) => render(this._reactEdgeRenderer, props, element));
|
|
41
|
-
return this;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
GraphReactT.prototype._class += " graph_GraphReactT";
|
|
1
|
+
import { render, React, SubgraphProps, VertexProps, EdgeProps } from "@hpcc-js/react";
|
|
2
|
+
import { GraphT, RendererT } from "./graphT";
|
|
3
|
+
|
|
4
|
+
function adapter<T>(reactRenderer: React.FunctionComponent<T>): RendererT<T> {
|
|
5
|
+
return (props: T, element: SVGGElement) => render(reactRenderer, props, element);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export class GraphReactT<SG extends SubgraphProps, V extends VertexProps, E extends EdgeProps<V>> extends GraphT<SG, V, E> {
|
|
9
|
+
|
|
10
|
+
constructor(subgraphRenderer: React.FunctionComponent<SG>, vertexRenderer: React.FunctionComponent<V>, edgeRenderer: React.FunctionComponent<E>) {
|
|
11
|
+
super(adapter(subgraphRenderer), adapter(vertexRenderer), adapter(edgeRenderer));
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
private _reactSubgraphRenderer: React.FunctionComponent<SG>;
|
|
15
|
+
subgraphRenderer(): React.FunctionComponent<SG>;
|
|
16
|
+
subgraphRenderer(_: React.FunctionComponent<SG>): this;
|
|
17
|
+
subgraphRenderer(_?: React.FunctionComponent<SG>): this | React.FunctionComponent<SG> {
|
|
18
|
+
if (!arguments.length) return this._reactSubgraphRenderer;
|
|
19
|
+
this._reactSubgraphRenderer = _;
|
|
20
|
+
super.subgraphRenderer(adapter(this._reactSubgraphRenderer));
|
|
21
|
+
return this;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
private _reactVertexRenderer: React.FunctionComponent<V>;
|
|
25
|
+
vertexRenderer(): React.FunctionComponent<V>;
|
|
26
|
+
vertexRenderer(_: React.FunctionComponent<V>): this;
|
|
27
|
+
vertexRenderer(_?: React.FunctionComponent<V>): this | React.FunctionComponent<V> {
|
|
28
|
+
if (!arguments.length) return this._reactVertexRenderer;
|
|
29
|
+
this._reactVertexRenderer = _;
|
|
30
|
+
super.vertexRenderer((props: V, element: SVGGElement) => render(this._reactVertexRenderer, props, element));
|
|
31
|
+
return this;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
private _reactEdgeRenderer: React.FunctionComponent<E>;
|
|
35
|
+
edgeRenderer(): React.FunctionComponent<E>;
|
|
36
|
+
edgeRenderer(_: React.FunctionComponent<E>): this;
|
|
37
|
+
edgeRenderer(_?: React.FunctionComponent<E>): this | React.FunctionComponent<E> {
|
|
38
|
+
if (!arguments.length) return this._reactEdgeRenderer;
|
|
39
|
+
this._reactEdgeRenderer = _;
|
|
40
|
+
super.edgeRenderer((props: E, element: SVGGElement) => render(this._reactEdgeRenderer, props, element));
|
|
41
|
+
return this;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
GraphReactT.prototype._class += " graph_GraphReactT";
|