tango-app-api-analysis-traffic 3.0.0-alpha.29 → 3.0.0-alpha.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tango-app-api-analysis-traffic",
3
- "version": "3.0.0-alpha.29",
3
+ "version": "3.0.0-alpha.30",
4
4
  "description": "Traffic Analysis",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -483,33 +483,28 @@ export const performanceMatrixV1 = async ( req, res ) => {
483
483
  let resultData = await LamdaServiceCall( LamdaURL, reqestData );
484
484
  if ( resultData ) {
485
485
  if ( resultData.status_code == '200' ) {
486
- resultData.performanceData.forEach( ( item ) => {
487
- delete item.top;
488
- delete item.left;
489
- } );
490
486
  let data = [];
491
487
  resultData.performanceData.forEach( ( item, index ) => {
492
- data.push( item );
493
- if ( item.position == 'High_Low' ) {
494
- data[index].left = Math.floor( Math.random() * 40 );
495
- data[index].top = Math.floor( Math.random() * 37 ) + 7;
496
- } else if ( item.position == 'High_High' ) {
497
- data[index].left = Math.floor( Math.random() * 40 ) + 50;
498
- data[index].top = Math.floor( Math.random() * 37 ) + 7; ;
499
- } else if ( item.position == 'Low_Low' ) {
500
- data[index].left = Math.floor( Math.random() * 40 );
501
- data[index].top = Math.floor( Math.random() * 37 ) + 51;
488
+ let findprevIndex = data.findLastIndex( ( ele ) => ele.position == item.position );
489
+ if ( findprevIndex != -1 ) {
490
+ item.top = data[findprevIndex].top + 7;
491
+ item.left = data[findprevIndex].left + 5;
502
492
  } else {
503
- data[index].left = Math.floor( Math.random() * 40 ) + 50;
504
- data[index].top = Math.floor( Math.random() * 37 ) + 51;
505
- }
506
- let maxTop = data[index].top + 3;
507
- let minTop = data[index].top - 3;
508
- let checkNearest = data.filter( ( ele ) => ele.position == item.position && minTop <= ele.top && maxTop >= ele.top );
509
- if ( checkNearest.length ) {
510
- data[index].top = data[index].top + 3;
511
- data[index].left = data[index].left + 5;
493
+ if ( item.position == 'High_Low' ) {
494
+ item.left = 5;
495
+ item.top = 10;
496
+ } else if ( item.position == 'High_High' ) {
497
+ item.left = 50;
498
+ item.top = 10;
499
+ } else if ( item.position == 'Low_Low' ) {
500
+ item.left = 5;
501
+ item.top = 55;
502
+ } else {
503
+ item.left = 50;
504
+ item.top = 55;
505
+ }
512
506
  }
507
+ data.push( item );
513
508
  } );
514
509
  resultData.performanceData = data;
515
510
  return res.sendSuccess( resultData );