How can we remove some colorscale/numbers from "Show points of gridded data source" Azure map?

Azure Dev 1 Reputation point
2022-12-19T07:08:53.827+00:00

Hello,

Currently, we are implementing azure Show points of gridded data source map. Below so the link for the same.

https://samples.azuremaps.com/?sample=show-points-of-gridded-data-source

Here, we want to exclude few colors and values. See the below screenshot.

271925-image.png

By default, map starts showing the hotspot and events from the 1 number but how can we start it from the other number like 25 and skip the number from 1 - 24.

Azure Maps
Azure Maps
An Azure service that provides geospatial APIs to add maps, spatial analytics, and mobility solutions to apps.
592 questions
Windows Maps
Windows Maps
A Microsoft app that provides voice navigation and turn-by-turn driving, transit, and walking directions.
245 questions
{count} votes

1 answer

Sort by: Most helpful
  1. AshokPeddakotla-MSFT 27,491 Reputation points
    2022-12-19T13:43:14.593+00:00

    @Azure Dev Welcome to Microsoft Q&A forum!

    Try the below code by modifying the corresponding values in the sample and let us know if it helps.

    I removed the 25 from colorScale and changed value from 1 to 25 in the createLegend() and seeing the result as shown in below.

    272099-image.png

    272079-image.png

     var colorScale = [  
                  
                50, '#f9ffb9',  
                75, '#ffb849',  
                100, '#ca0056'  
            ];  
    
    function createLegend() {  
                var html = [];  
                html.push('<i style="background:', defaultColor, '"></i> 25 - ', colorScale[0], '<br/>');  
      
                for (var i = 0; i < colorScale.length; i += 2) {  
                    html.push(  
                        '<i style="background:', (colorScale[i + 1]), '"></i> ',  
                        colorScale[i], (colorScale[i + 2] ? ' - ' + colorScale[i + 2] + '<br/>' : '+')  
                    );  
                }  
    

    Output:

    272143-image.png

    Do let us know if it helps or have any further queries. If you are looking for something different, feel free to comment or respond we would be happy to assist you.

    If the response is helpful, please click "Accept Answer" and upvote it.