[CORD-1043] Registering reducers on the graph
Change-Id: I5804025f25733b5b5da1fd95725db3467a65abef
diff --git a/src/app/service-graph/services/d3-helpers/graph.helpers.ts b/src/app/service-graph/services/d3-helpers/graph.helpers.ts
new file mode 100644
index 0000000..4bf4cb8
--- /dev/null
+++ b/src/app/service-graph/services/d3-helpers/graph.helpers.ts
@@ -0,0 +1,25 @@
+import * as d3 from 'd3';
+
+export interface Id3BBox {
+ x: number;
+ y: number;
+ width: number;
+ height: number;
+}
+
+export interface IXosGraphHelpers {
+ parseElemClasses (classes: string): string;
+ getSiblingTextBBox(contex: any /* D3 this */): Id3BBox;
+}
+
+export class XosGraphHelpers implements IXosGraphHelpers {
+ public parseElemClasses (classes: string): string {
+ return classes ? classes.split(' ')
+ .map(c => `ext-${c}`)
+ .join(' ') : '';
+ }
+
+ public getSiblingTextBBox(contex: any): Id3BBox {
+ return d3.select(contex.parentNode).select('text').node().getBBox();
+ }
+}