Splunk Search

Influencing the order of chloropeth map legend without numbering

andrewwjc
Engager

I'm using rangemap (mapped with field colors respectively) in chloropeth maps to sort the legend accordingly. However, is there a way to remove the numbering in front of each range and still have the order in the way I want it ? Once I remove the numbers, the order runs.
I tried pre-pending spaces in front but it doesn't work properly.

    <panel>
      <title>Monthly Volume Trend (%)</title>
      <map>
        <search base="First_Base_Search">
          <query>search $OriginCtryCode$
          | search $OriginRegion$
          | search $DstCtryCode$
          | search $DestRegion$
          | stats sum(eval(if(_time>=relative_time(now(),"-31d"),SHP_VOL,0))) as Latest30Days,sum(eval(if(_time>=relative_time(now(),"-61d") AND _time<relative_time(now(),"-31d"),SHP_VOL,0))) as Prev30Days by DEST_COUNTRY_CODE
          | eval PercentageDiff=round((Latest30Days-Prev30Days)/Prev30Days*100)
          | table DEST_COUNTRY_CODE,Latest30Days,Prev30Days,PercentageDiff  
          | rename DEST_COUNTRY_CODE as iso2 | lookup geo_attr_countries iso2 OUTPUT country | where !isnull(country) 
          | rangemap field=PercentageDiff "1. Over 50%"=50.01-1000 "2. 20% to 50%"=20.01-50 "3. 10% to 20%"=10.01-20 "4. 0% - 10%"=0.01-10 "5. 0% to -10%"=-9.99-0 "6. -10% to -20%"=-19.99--10 "7. -20% to -50%"=-49.99--20 "8. Over -50%"=-1000--50  | fields+ country, range | sort range | geom geo_countries featureIdField="country"</query>
        </search>
        <option name="drilldown">none</option>
        <!--option name="mapping.choroplethLayer.colorBins">8</option-->
        <option name="mapping.fieldColors">{"1. Over 50%":0x39A800,"2. 20% to 50%":0x64B73F,"3. 10% to 20%":0xA6D48C,"4. 0% - 10%":0xC4E3B2,"5. 0% to -10%":"0xFF9E81","6. -10% to -20%":0xFF7B5A,"7. -20% to -50%":0xFF5232,"8. Over -50%":0xFF0000,"None":0xFFFFFF}</option>
        <!--option name="mapping.choroplethLayer.colorMode">categorical</option>
        <option name="mapping.choroplethLayer.maximumColor">0x53a051</option>
        <option name="mapping.choroplethLayer.minimumColor">0xdc4e41</option-->
        <option name="mapping.choroplethLayer.shapeOpacity">0.7</option>
        <option name="mapping.map.zoom">2</option>
        <option name="mapping.showTiles">1</option>
        <option name="mapping.tileLayer.tileOpacity">0.7</option>
        <option name="mapping.type">choropleth</option>
      </map>
    </panel>

To further illustrate, I would like the legend to be sorted in this exact order when the numbering is removed:-

alt text

0 Karma
Get Updates on the Splunk Community!

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  &#x1f680; Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Stronger Security with Federated Search for S3, GCP SQL & Australian Threat ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Accelerating Observability as Code with the Splunk AI Assistant

We’ve seen in previous posts what Observability as Code (OaC) is and how it’s now essential for managing ...