Different polyline denoting different types of attack

Hi everyone,

My json array of data contains an ‘alert’. For instance (here is an extract of my data):

[{***“alert”:“system beaconing attack”, “so on and so forth …”},*

*** {***“alert”:“ddos attack”,“so on and so forth …”}**]

A polyline was created successfully in the past with the following codes:

var target = viewer.entities.add({

  • name: (sourceCountry + " - " + destCountry),*
  • position: positions,*
  • orientation: new Cesium.VelocityOrientationProperty(positions),*
  • path: {*
  • resolution: 1,*
    
  • material: new Cesium.PolylineGlowMaterialProperty({*
    
  • glowPower: 0.1,*
    
  • color: Cesium.Color.RED*
    

}),

  • width: 4,*

_ trailTime: 12460*60,_

  •     leadTime: 0*
    
  • }*

});

target.position.setInterpolationOptions({

  • interpolationDegree: 5,*
  • interpolationAlgorithm: Cesium.LagrangePolynomialApproximation*

});

I’ve attempted to make the polyline colors to be different colours from one another (Which clearly, I can’t seem to make it work), based on the alert so that when users view the visualization, they can easily distinguish which colour is referring to which type of attack. For example:

alert: system beaconing attack (Yellow)

alert: ddos attack (Blue)

Here is what I’ve attempted, but the polylines still show the same colour:

if (alert == “system beaconing attack”){

  • var target = viewer.entities.add({*
  • name: (sourceCountry + " - " + destCountry),*
    
  • position: positions,*
    
  • orientation: new Cesium.VelocityOrientationProperty(positions),*
    
  • path: {*
    
  • 	resolution: 1,*
    
  • 	material: new Cesium.PolylineGlowMaterialProperty({*
    
  • 		glowPower: 0.1,*
    
  • 		color: Cesium.Color.BLUE*
    
  • 	}),*
    
  • 	width: 4,*
    

_ trailTime: 12460*60,_

  • 	leadTime: 0*
    
  • }*
    
  • });*
  • target.position.setInterpolationOptions({*
  • interpolationDegree: 5,*
    
  • interpolationAlgorithm: Cesium.LagrangePolynomialApproximation*
    
  • });*

} else {

  • var target = viewer.entities.add({*
  • name: (sourceCountry + " - " + destCountry),*
    
  • position: positions,*
    
  • orientation: new Cesium.VelocityOrientationProperty(positions),*
    
  • path: {*
    
  • 	resolution: 1,*
    
  • 	material: new Cesium.PolylineGlowMaterialProperty({*
    
  • 		glowPower: 0.1,*
    
  • 		color: Cesium.Color.GREEN*
    
  • 	}),*
    
  • 	width: 4,*
    

_ trailTime: 12460*60,_

  • 	leadTime: 0*
    
  • }*
    
  • });*
  • target.position.setInterpolationOptions({*
  • interpolationDegree: 5,*
    
  • interpolationAlgorithm: Cesium.LagrangePolynomialApproximation*
    
  • });*

};

Hope you guys are able to help! Thank you.

Alan