Need to update Maps icons based on last updated duration

Hello,

I am using version 4.1 GA of Helical Insight. I have created a map and I see the locations based on the icon I have updated. However, I want these locations to be shown in different colour icons, based on a dimension i.e. a text value. I have referred to other question wherein there is a reference of how to do the same based on a number column but I want to do this based on a text column.

I have icons files for each of the need. Can this be achieved with your application?

Our requirement: my data refreshes every 30 minutes. If the last refresh is within 15 mins, the green icon should appear; if it is between 15 to 20, yellow; 20 to 30, orange; anything which is beyond 30 minutes should appear red.

We have values Red, Green, Orange and Yellow coming in respectively in one of the column. Now we need to show them on maps with icons.

Please help.

Thanks,
Netta.

Hello Netta,

We are sharing a sample code below which you can put through which it can allow you to implement the same.
You can see that there are set of 4 values (and a default to catch any error). You can update is as per your needs. We would like to explain the inner working so that you can customize and apply in your own environment. There are 3 key elements that you need to keep in mind and replace them as per your own values.

  1. Name of the column where you have already calculated the values as custom column (in this code we have used “Time_Diff”).
  2. The value(s) that you have in this column that you want to replace the icons on the map with (in this code we have values like “RED”).
  3. the image icon(s) to be associated with respective value(s) (in this example the icon mapped to value “Red” is “coldroom_red.png”).

Here is the code


hi_container.set("postFetch",function(c){

var viz_Options = c.get("viz_Options");

var responseData = c.get("responseData");

viz_Options.chartOptions.customIconRendring = true

viz_Options.chartOptions.customIcon = true

viz_Options.chartOptions.valueBasedOn = "Time_Diff"

let custonIconsFromPF = {}

for(var i=0;i measure = responseData.data[i][viz_Options.chartOptions.valueBasedOn];

if(measure == "RED"){

custonIconsFromPF[measure] = "coldroom_red.png" ;

}

else if(measure == "GREEN"){

custonIconsFromPF[measure] = "coldroom_green.png" ;

}

else if(measure == "YELLOW"){

custonIconsFromPF[measure] = "coldroom_yellow.png" ;

}

else if(measure == "ORANGE"){

custonIconsFromPF[measure] = "coldroom_orange.png" ;

}

else{

custonIconsFromPF[measure] = "coldroom_gray.png" ;

}

}

viz_Options.chartOptions.custonIconsFromPF = custonIconsFromPF

c.set("viz_Options",viz_Options);

});

Thanks,
Helical Insight.