@@ -7,8 +7,8 @@ import { DataStore } from 'src/app/model/data-store';
77export interface graphNodes {
88 id : string ;
99 relativeLevel : number ;
10- index : number ;
11- activitycount : number ;
10+ activityIndex : number ;
11+ activityCount : number ;
1212}
1313
1414export interface graphLinks {
@@ -70,6 +70,7 @@ export class DependencyGraphComponent implements OnInit, OnChanges {
7070 this . dataStore ?. activityStore ?. getActivityByName ( activityName ) ;
7171 if ( activity ) {
7272 this . graphData = { nodes : [ ] , links : [ ] } ;
73+ this . addNode ( activity . name ) ;
7374 this . populateGraphWithActivitiesCurrentActivityDependsOn ( activity ) ;
7475 this . populateGraphWithActivitiesThatDependsOnCurrentActivity ( activity ) ;
7576
@@ -78,7 +79,6 @@ export class DependencyGraphComponent implements OnInit, OnChanges {
7879 }
7980
8081 populateGraphWithActivitiesCurrentActivityDependsOn ( activity : Activity ) : void {
81- this . addNode ( activity . name ) ;
8282 if ( activity . dependsOn ) {
8383 let i : number = 1 ;
8484 for ( const prececcor of activity . dependsOn ) {
@@ -91,7 +91,7 @@ export class DependencyGraphComponent implements OnInit, OnChanges {
9191 this . graphData [ 'nodes' ]
9292 . filter ( node => node . relativeLevel == - 1 )
9393 . forEach ( node => {
94- node . activitycount = i - 1 ;
94+ node . activityCount = i - 1 ;
9595 } ) ;
9696 }
9797 }
@@ -111,28 +111,28 @@ export class DependencyGraphComponent implements OnInit, OnChanges {
111111 this . graphData [ 'nodes' ]
112112 . filter ( node => node . relativeLevel == 1 )
113113 . forEach ( node => {
114- node . activitycount = i - 1 ;
114+ node . activityCount = i - 1 ;
115115 } ) ;
116116 }
117117
118- addNode ( activityName : string , relativeLevel : number = 0 , index : number = 0 ) : void {
118+ addNode ( activityName : string , relativeLevel : number = 0 , activityIndex : number = 0 ) : void {
119119 if ( ! this . visited . has ( activityName ) ) {
120120 let d : any = {
121121 id : activityName ,
122122 relativeLevel,
123- index ,
123+ activityIndex ,
124124 } ;
125125 this . graphData [ 'nodes' ] . push ( d ) ;
126126 this . visited . add ( activityName ) ;
127127 }
128128 }
129129
130130 initX ( d : any ) : number {
131- let col : number = 7 ;
132- if ( d . activitycount > col && d . activitycount < col * 2 ) {
133- col = Math . ceil ( d . activitycount / 2 ) ;
131+ let col : number = 8 ;
132+ if ( d . activityCount > col && d . activityCount < col * 2 ) {
133+ col = Math . ceil ( d . activityCount / 2 ) ;
134134 }
135- return d . relativeLevel * Math . ceil ( d . index / col ) * 300 ;
135+ return d . relativeLevel * Math . ceil ( d . activityIndex / col ) * 300 ;
136136 }
137137 initY ( d : any ) : number {
138138 return d . relativeLevel * 30 ;
0 commit comments