@@ -849,7 +849,7 @@ class HIVTxNetwork {
849
849
850
850
*/
851
851
852
- attribute_node_value_by_id ( d , id , number ) {
852
+ attribute_node_value_by_id ( d , id , number , is_date ) {
853
853
try {
854
854
if ( kGlobals . network . NodeAttributeID in d && id ) {
855
855
if ( id in d [ kGlobals . network . NodeAttributeID ] ) {
@@ -867,6 +867,8 @@ class HIVTxNetwork {
867
867
} else if ( number ) {
868
868
v = Number ( v ) ;
869
869
return _ . isNaN ( v ) ? kGlobals . missing . label : v ;
870
+ } else if ( date ) {
871
+ return v . getTime ( ) ;
870
872
}
871
873
}
872
874
return v ;
@@ -1764,8 +1766,8 @@ class HIVTxNetwork {
1764
1766
} ) ;
1765
1767
1766
1768
const pg_enum = [
1767
- "Yes (dx≤ 12 months)" ,
1768
- "Yes (12<dx≤ 36 months)" ,
1769
+ "Yes (dx� 12 months)" ,
1770
+ "Yes (12<dx� 36 months)" ,
1769
1771
"Yes (dx>36 months)" ,
1770
1772
"No" ,
1771
1773
] ;
@@ -2117,10 +2119,6 @@ class HIVTxNetwork {
2117
2119
_ . has ( this . json [ kGlobals . network . GraphAttrbuteID ] , d )
2118
2120
)
2119
2121
) {
2120
- var extension = { } ;
2121
- extension [ key ] = computed ;
2122
-
2123
- _ . extend ( this . json [ kGlobals . network . GraphAttrbuteID ] , extension ) ;
2124
2122
this . inject_attribute_description ( key , computed ) ;
2125
2123
_ . each ( this . json . Nodes , ( node ) => {
2126
2124
HIVTxNetwork . inject_attribute_node_value_by_id (
@@ -2135,15 +2133,48 @@ class HIVTxNetwork {
2135
2133
this . uniqValues [ key ] = computed . enum ;
2136
2134
} else {
2137
2135
var uniq_value_set = new Set ( ) ;
2138
- _ . each ( this . json . Nodes , ( n ) =>
2139
- uniq_value_set . add (
2140
- this . attribute_node_value_by_id ( n , key , computed . Type === "Number" )
2141
- )
2142
- ) ;
2136
+
2137
+ if ( computed . type === "Date" ) {
2138
+ _ . each ( this . json . Nodes , ( n ) =>
2139
+ uniq_value_set . add (
2140
+ this . attribute_node_value_by_id ( n , key ) . getTime ( )
2141
+ )
2142
+ ) ;
2143
+ } else {
2144
+ _ . each ( this . json . Nodes , ( n ) =>
2145
+ uniq_value_set . add (
2146
+ this . attribute_node_value_by_id (
2147
+ n ,
2148
+ key ,
2149
+ computed . type === "Number"
2150
+ )
2151
+ )
2152
+ ) ;
2153
+ }
2154
+
2143
2155
this . uniqValues [ key ] = [ ...uniq_value_set ] ;
2156
+ if ( computed . type === "Number" || computed . type == "Date" ) {
2157
+ var color_stops =
2158
+ computed [ "color_stops" ] || kGlobals . network . ContinuousColorStops ;
2159
+
2160
+ if ( color_stops > this . uniqValues [ key ] . length ) {
2161
+ computed [ "color_stops" ] = this . uniqValues [ key ] . length ;
2162
+ }
2163
+
2164
+ if ( computed . type === "Number" ) {
2165
+ computed . is_integer = _ . every ( this . uniqValues [ key ] , ( d ) =>
2166
+ Number . isInteger ( d )
2167
+ ) ;
2168
+ }
2169
+ }
2144
2170
}
2145
2171
this . uniqs [ key ] = this . uniqValues [ key ] . length ;
2146
2172
2173
+ var extension = { } ;
2174
+ extension [ key ] = computed ;
2175
+
2176
+ _ . extend ( this . json [ kGlobals . network . GraphAttrbuteID ] , extension ) ;
2177
+
2147
2178
if ( computed [ "overwrites" ] ) {
2148
2179
if (
2149
2180
_ . has (
@@ -2196,13 +2227,13 @@ class HIVTxNetwork {
2196
2227
2197
2228
const subcluster_enum = [
2198
2229
"No, dx>36 months" , // 0
2199
- "No, but dx≤ 12 months" ,
2200
- "Yes (dx≤ 12 months)" ,
2201
- "Yes (12<dx≤ 36 months)" ,
2230
+ "No, but dx� 12 months" ,
2231
+ "Yes (dx� 12 months)" ,
2232
+ "Yes (12<dx� 36 months)" ,
2202
2233
"Future node" , // 4
2203
2234
"Not a member of subcluster" , // 5
2204
2235
"Not in a subcluster" ,
2205
- "No, but 12<dx≤ 36 months" ,
2236
+ "No, but 12<dx� 36 months" ,
2206
2237
] ;
2207
2238
2208
2239
return {
@@ -2407,7 +2438,7 @@ class HIVTxNetwork {
2407
2438
depends : [ timeDateUtil . _networkCDCDateField ] ,
2408
2439
label : label ,
2409
2440
type : "Number" ,
2410
- label_format : d3 . format ( ".2f" ) ,
2441
+ label_format : relative ? d3 . format ( ".2f" ) : d3 . format ( ".0f ") ,
2411
2442
map : ( node ) => {
2412
2443
try {
2413
2444
var value = this . parse_dates (
@@ -2526,7 +2557,7 @@ class HIVTxNetwork {
2526
2557
depends : [ "age_dx" ] ,
2527
2558
overwrites : "age_dx" ,
2528
2559
label : "Age at Diagnosis" ,
2529
- enum : [ "<13" , "13-19" , "20-29" , "30-39" , "40-49" , "50-59" , "≥ 60" ] ,
2560
+ enum : [ "<13" , "13-19" , "20-29" , "30-39" , "40-49" , "50-59" , "� 60" ] ,
2530
2561
type : "String" ,
2531
2562
color_scale : function ( ) {
2532
2563
return d3 . scale
@@ -2538,7 +2569,7 @@ class HIVTxNetwork {
2538
2569
"30-39" ,
2539
2570
"40-49" ,
2540
2571
"50-59" ,
2541
- "≥ 60" ,
2572
+ "� 60" ,
2542
2573
kGlobals . missing . label ,
2543
2574
] )
2544
2575
. range ( [
@@ -2555,13 +2586,13 @@ class HIVTxNetwork {
2555
2586
map : ( node ) => {
2556
2587
var vl_value = this . attribute_node_value_by_id ( node , "age_dx" ) ;
2557
2588
if ( vl_value === ">=60" ) {
2558
- return "≥ 60" ;
2589
+ return "� 60" ;
2559
2590
}
2560
2591
if ( vl_value === "\ufffd60" ) {
2561
- return "≥ 60" ;
2592
+ return "� 60" ;
2562
2593
}
2563
2594
if ( Number ( vl_value ) >= 60 ) {
2564
- return "≥ 60" ;
2595
+ return "� 60" ;
2565
2596
}
2566
2597
return vl_value ;
2567
2598
} ,
0 commit comments