How to customize heatmap color on pre decided constraint values?

المشرف العام

Administrator
طاقم الإدارة
I am working on heatmap and situation is i have to change the color of heat map marker on the basis of some constraints and the color should change according to those basic constraints values. My approach is this:

function HeatMapCreate(heatMapData, GetNumberFromString) // heatMapData contains the object of LatLng and get number is the constraint // which contains a number on the basis of which we set color // (green if 48 and red if 36 else yellow) { var gradient; var heatmap = new google.maps.visualization.HeatmapLayer( { data: heatMapData, }); heatmap.setOptions({ radius: heatmap.get('20') }); if (GetNumberFromString == 36) { gradient = [For red color] } else if(GetNumberFromString == 48) { gradient = [For green color] } else { gradient = [For yellow color] } heatmap.set('gradient', heatmap.get('gradient') ? null : gradient); heatmap.setMap(map); }How to achieve this ? I am bit surprised there is not a single answer (even comment) to this answer, that makes me feel either question is too bad or it is impossible to have heatmap markers of different color ? Could some one please help me ?



أكثر...
 
أعلى