@@ -129,6 +129,7 @@ if (mode === 'realTime') {
129129 } ) ;
130130
131131 startRealTimePolling ( ) ; // trigger reload on range change
132+
132133 } )
133134 . dispatch ( 'change' ) ; // trigger once on load
134135
@@ -372,6 +373,8 @@ function startRealTimePolling() {
372373 request = new Simulation ( fetchDataAndProcess ( realTimeParams ) ) ;
373374 }
374375 fetchAndUpdate ( ) ;
376+ initdraw ( ) ;
377+ initTimeElement ( ) ;
375378 realTimeIntervalId = setInterval ( fetchAndUpdate , intervalMs ) ;
376379}
377380function loadHistoricalData ( ) {
@@ -387,6 +390,8 @@ function loadHistoricalData() {
387390
388391 const historicalParams = buildHistoricalParams ( start , end ) ;
389392 request = new Simulation ( fetchDataAndProcess ( historicalParams ) ) ;
393+ initdraw ( ) ;
394+ initTimeElement ( ) ;
390395}
391396d3 . selectAll ( '#navMode li a' ) . on ( 'click' , function ( ) {
392397 const mode = d3 . select ( this . parentNode ) . classed ( 'realtime' ) ? 'realTime' : 'historical' ;
@@ -437,7 +442,7 @@ $(document).ready(function () {
437442 enable : true ,
438443 idroot : index ,
439444 angle : 0 ,
440- range : [ 0 , 1000 ]
445+ range : [ 0 , 3000 ]
441446 } ]
442447 } ) ) ;
443448 serviceFullList = [ ] ;
@@ -459,8 +464,8 @@ $(document).ready(function () {
459464 updateProcess ( { percentage : 5 , text : 'Load UI...' } )
460465 initMenu ( ) ;
461466 updateProcess ( { percentage : 15 , text : 'Preprocess data...' } ) ;
462- initdraw ( ) ;
463- initTimeElement ( ) ;
467+ // initdraw();
468+ // initTimeElement();
464469} ) ;
465470
466471// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -880,13 +885,44 @@ $(document).ready(function () {
880885// initTimeElement();
881886// // queryLayout().then(()=>request.request());
882887// });
888+ function getMetricMax ( nodes_info , metric ) {
889+ let max = 0 ;
890+ Object . values ( nodes_info ) . forEach ( node => {
891+ const series = node [ metric ] || [ ] ;
892+ series . forEach ( values => {
893+ ( values || [ ] ) . forEach ( v => {
894+ if ( typeof v === 'number' && ! isNaN ( v ) ) {
895+ max = Math . max ( max , v ) ;
896+ }
897+ } ) ;
898+ } ) ;
899+ } ) ;
900+ return max ;
901+ }
883902
884903function initTimeElement ( ) {
885904
886905 // request.onFinishQuery.push(queryData);
887906 request . onDataChange . push ( ( data ) => {
888907 updateProcess ( { percentage : 50 , text : 'Preprocess data' } )
889908 setTimeout ( ( ) => {
909+
910+ // serviceLists = serviceListattr.map((key, index) => {
911+ // const max = getMetricMax(data.nodes_info, key);
912+ // return {
913+ // text: key,
914+ // id: index,
915+ // enable: true,
916+ // sub: [{
917+ // text: key,
918+ // id: 0,
919+ // enable: true,
920+ // idroot: index,
921+ // angle: 0,
922+ // range: [0, Math.ceil(max * 1.1)] // add 10% headroom
923+ // }]
924+ // };
925+ // });
890926 handleRankingData ( data ) ;
891927 updateProcess ( { percentage : 80 , text : 'Preprocess data' } )
892928 drawJobList ( ) ;
0 commit comments