@@ -73,7 +73,7 @@ const countyloaddata = getCountyNodes(data);
73
73
data = countyloaddata . updatedata ;
74
74
75
75
76
- var flowdata = ExtractFlowData ( data ) ;
76
+ const flowdata = ExtractFlowData ( data ) ;
77
77
78
78
const Points = getPoints ( data ) ;
79
79
const Voltages = Points . map ( d => d . value ) ;
@@ -182,7 +182,7 @@ export default function App({ refdata = data, refflowdata = flowdata, ggdata = g
182
182
183
183
const [ netfiltervalue , setNetFilterValue ] = useState ( [ 0 , 800 ] ) ;
184
184
185
- const [ flowfiltervalue , setFlowFilterValue ] = useState ( [ 0 , 800 ] ) ;
185
+ const [ flowfiltervalue , setFlowFilterValue ] = useState ( [ 0 , 120 ] ) ;
186
186
187
187
const [ loadfiltervalue , setLoadFilterValue ] = useState ( [ 0 , countyloaddata . maxPd ] ) ;
188
188
@@ -213,26 +213,32 @@ export default function App({ refdata = data, refflowdata = flowdata, ggdata = g
213
213
lat : feature . geometry . coordinates [ 1 ]
214
214
} )
215
215
} else if ( feature . geometry . type === "LineString" && lineNameSelectItems . includes ( feature . properties . NAME ) ) {
216
+ var RATE_A ;
217
+ if ( feature . properties . RATE_A == 0 ) {
218
+ RATE_A = 10000 ;
219
+ } else {
220
+ RATE_A = feature . properties . RATE_A ;
221
+ }
222
+ var loading = Math . abs ( feature . properties . PF / RATE_A ) * 100 ;
216
223
if ( feature . properties . PF > 0 ) {
217
224
const [ origin , dest ] = feature . properties . NAME . split ( ' -- ' )
218
225
flows . push ( {
219
226
origin : origin ,
220
227
dest : dest ,
221
- count : Math . abs ( feature . properties . PF )
228
+ count : feature . properties . KV ,
229
+ loading : loading
222
230
} )
223
231
} else {
224
232
const [ dest , origin ] = feature . properties . NAME . split ( ' -- ' )
225
233
flows . push ( {
226
234
origin : origin ,
227
235
dest : dest ,
228
- count : Math . abs ( feature . properties . PF )
236
+ count : feature . properties . KV ,
237
+ loading : loading
229
238
} )
230
239
}
231
-
232
240
}
233
-
234
241
} )
235
-
236
242
} else if ( busNameSelectItems . length > 0 ) {
237
243
238
244
data . features . forEach ( feature => {
@@ -244,63 +250,80 @@ export default function App({ refdata = data, refflowdata = flowdata, ggdata = g
244
250
lat : feature . geometry . coordinates [ 1 ]
245
251
} )
246
252
} else if ( feature . geometry . type === "LineString" && feature . properties . NAME . split ( ' -- ' ) . some ( r => busNameSelectItems . includes ( r ) ) ) {
253
+ var RATE_A ;
254
+ if ( feature . properties . RATE_A == 0 ) {
255
+ RATE_A = 10000 ;
256
+ } else {
257
+ RATE_A = feature . properties . RATE_A ;
258
+ }
259
+
260
+ var loading = Math . abs ( feature . properties . PF / RATE_A ) * 100 ;
247
261
if ( feature . properties . PF > 0 ) {
248
262
const [ origin , dest ] = feature . properties . NAME . split ( ' -- ' )
249
263
flows . push ( {
250
264
origin : origin ,
251
265
dest : dest ,
252
- count : Math . abs ( feature . properties . PF )
266
+ count : feature . properties . KV ,
267
+ loading : loading
253
268
} )
254
269
} else {
255
270
const [ dest , origin ] = feature . properties . NAME . split ( ' -- ' )
256
271
flows . push ( {
257
272
origin : origin ,
258
273
dest : dest ,
259
- count : Math . abs ( feature . properties . PF )
274
+ count : feature . properties . KV ,
275
+ loading : loading
260
276
} )
261
277
}
262
278
263
279
}
264
280
265
281
} )
266
282
}
267
- else {
283
+ else {
268
284
data . features . forEach ( feature => {
269
285
if ( feature . geometry . type === "Point" && netfiltervalue [ 0 ] <= feature . properties . KVlevels [ 0 ] &&
270
- feature . properties . KVlevels [ 0 ] <= netfiltervalue [ 1 ] &&
271
- flowfiltervalue [ 0 ] <= feature . properties . KVlevels [ 0 ] &&
272
- feature . properties . KVlevels [ 0 ] <= flowfiltervalue [ 1 ] ) {
286
+ feature . properties . KVlevels [ 0 ] <= netfiltervalue [ 1 ] ) {
273
287
locations . push ( {
274
288
id : feature . properties . NAME ,
275
289
name : feature . properties . NAME ,
276
290
lon : feature . geometry . coordinates [ 0 ] ,
277
291
lat : feature . geometry . coordinates [ 1 ]
278
292
} )
279
293
} else if ( feature . geometry . type === "LineString" && netfiltervalue [ 0 ] <= feature . properties . KV &&
280
- feature . properties . KV <= netfiltervalue [ 1 ] &&
281
- flowfiltervalue [ 0 ] <= feature . properties . KV &&
282
- feature . properties . KV <= flowfiltervalue [ 1 ] ) {
283
- if ( feature . properties . PF > 0 ) {
284
- const [ origin , dest ] = feature . properties . NAME . split ( ' -- ' )
285
- flows . push ( {
286
- origin : origin ,
287
- dest : dest ,
288
- count : Math . abs ( feature . properties . PF )
289
- } )
290
- } else {
291
- const [ dest , origin ] = feature . properties . NAME . split ( ' -- ' )
292
- flows . push ( {
293
- origin : origin ,
294
- dest : dest ,
295
- count : Math . abs ( feature . properties . PF )
296
- } )
297
- }
298
-
294
+ feature . properties . KV <= netfiltervalue [ 1 ] ) {
295
+ var RATE_A ;
296
+ if ( feature . properties . RATE_A == 0 ) {
297
+ RATE_A = 10000 ;
298
+ } else {
299
+ RATE_A = feature . properties . RATE_A ;
300
+ }
301
+ var loading = Math . abs ( feature . properties . PF / RATE_A ) * 100.0 ;
302
+
303
+ if ( flowfiltervalue [ 0 ] <= loading && loading <= flowfiltervalue [ 1 ] ) {
304
+ if ( feature . properties . PF > 0 ) {
305
+ const [ origin , dest ] = feature . properties . NAME . split ( ' -- ' )
306
+ flows . push ( {
307
+ origin : origin ,
308
+ dest : dest ,
309
+ count : feature . properties . KV ,
310
+ loading : loading
311
+ } )
312
+ } else {
313
+ const [ dest , origin ] = feature . properties . NAME . split ( ' -- ' )
314
+ flows . push ( {
315
+ origin : origin ,
316
+ dest : dest ,
317
+ count : feature . properties . KV ,
318
+ loading : loading
319
+ } )
320
+ }
321
+ }
299
322
}
300
-
301
323
} )
302
- }
303
- const newflowdata = { locations : locations , flows : flows }
324
+ }
325
+
326
+ const newflowdata = { locations : locations , flows : flows , maxloading : 120 }
304
327
setFlowData ( newflowdata ) ;
305
328
} , [ data , netfiltervalue , flowfiltervalue , lineNameSelectItems ] ) ;
306
329
@@ -554,16 +577,15 @@ export default function App({ refdata = data, refflowdata = flowdata, ggdata = g
554
577
toggleMsgLoader ( ) ; // close loading
555
578
} , [ ouputMes ] ) ;
556
579
557
-
558
-
559
580
const handleNetLayerChange = ( event ) => {
560
581
setNetLayerActive ( event . target . checked ) ;
561
582
setNetFilterValue ( [ 0 , 800 ] ) ;
562
583
} ;
563
584
564
585
565
586
const handleFlowLayerChange = ( event ) => {
566
- setFlowLayerActive ( event . target . checked ) ;
587
+ setFlowLayerActive ( event . target . checked ) ;
588
+ setFlowFilterValue ( [ 0 , 120 ] ) ;
567
589
} ;
568
590
569
591
const handleLoadLayerChange = ( event ) => {
@@ -640,16 +662,29 @@ export default function App({ refdata = data, refflowdata = flowdata, ggdata = g
640
662
if ( netfiltervalue [ 0 ] <= KV && KV <= netfiltervalue [ 1 ] ) return KV ;
641
663
}
642
664
} else {
643
- /* Line layer */
644
- return data . properties . KV ;
665
+ if ( data . geometry . type == 'LineString' ) { /* Line layer */
666
+ /* Uncomment to activate flow-based filtering
667
+ var RATE_A;
668
+ if(data.properties.RATE_A == 0) {
669
+ RATE_A = 10000;
670
+ } else {
671
+ RATE_A = data.properties.RATE_A;
672
+ }
673
+ var loading = Math.abs(data.properties.PF / RATE_A)*100;
674
+ if(flowfiltervalue[0] <= loading && loading <= flowfiltervalue[1]) {
675
+ return data.properties.KV;
676
+ }
677
+ */
678
+ return data . properties . KV ;
679
+ }
645
680
}
646
681
}
647
682
648
683
return - 1 ; // This is beyond the range so filter will filter out this data point.
649
684
}
650
685
651
686
function getFlowFilterValue ( data ) {
652
- console . log ( data )
687
+
653
688
}
654
689
655
690
function getGenFilterValue ( data ) {
@@ -777,7 +812,7 @@ export default function App({ refdata = data, refflowdata = flowdata, ggdata = g
777
812
778
813
extensions : [ new DataFilterExtension ( { filtersize : 1 } ) ] ,
779
814
updateTriggers : {
780
- getFilterValue : [ netfiltervalue , lineNameSelectItems , busNameSelectItems ]
815
+ getFilterValue : [ netfiltervalue , lineNameSelectItems , busNameSelectItems , flowfiltervalue ]
781
816
}
782
817
} ) ,
783
818
@@ -1293,9 +1328,9 @@ export default function App({ refdata = data, refflowdata = flowdata, ggdata = g
1293
1328
valueLabelDisplay = "auto"
1294
1329
onChange = { handleFlowRangeFilterChange }
1295
1330
getAriaValueText = { valuetext }
1296
- step = { 100 }
1331
+ step = { 10 }
1297
1332
min = { 0 }
1298
- max = { 800 }
1333
+ max = { 120 }
1299
1334
>
1300
1335
</ Slider > </ div > )
1301
1336
}
0 commit comments