Dashboards & Visualizations

Can map visualizations' latitude, longitude, and zoom respond and adapt to the resultset returned, or on click of a button for a certain region??

hylam
Contributor

Can I have a USA button and a China button that moves and zooms the map?
Can the map move to China if the resultset shows China? Can the map move to USA if the resultset shows USA? Can the move and zoom include China, USA, and Pacific Ocean if the resultset shows both China and USA?

1 Solution

mporath_splunk
Splunk Employee
Splunk Employee

You can do all of that with the dashboard Link Switcher capabilities:

For manual country switching
- Create a form element with your countries
- Setup a link switcher like the one below

<form>
  <label>Test switcher</label>
  <fieldset submitButton="false">
    <input type="radio" token="country">
      <label>Country</label>
      <choice value="China">China</choice>
      <choice value="US">US</choice>
      <default>China</default>
      <change>
        <condition value="China">
          <set token="showChina">true</set>
          <unset token="showUs"></unset>
        </condition>
        <condition value="US">
          <unset token="showChina"></unset>
          <set token="showUs">true</set>
        </condition>
      </change>
    </input>
  </fieldset>
  <row>
    <panel>
      <title>Current Country</title>
      <map depends="$showUs$">
        <title>$country$</title>
        <search>
          <query>lat lon | head 1000 | lookup geo_countries longitude AS lon, latitude AS lat | stats count by featureId | geom geo_countries</query>
        </search>
            <option name="mapping.map.center">(37.3,-81.65)</option>
            <option name="mapping.map.panning">true</option>
            <option name="mapping.map.scrollZoom">false</option>
            <option name="mapping.map.zoom">4</option>
            <option name="mapping.type">choropleth</option>
            <option name="drilldown">all</option>
      </map>
      <map depends="$showChina$">
        <title>$country$</title>
        <search>
          <query>lat lon | head 1000 | lookup geo_countries longitude AS lon, latitude AS lat | stats count by featureId | geom geo_countries</query>
          <earliest></earliest>
          <latest></latest>
        </search>
            <option name="mapping.map.center">(32.32,103.62)</option>
            <option name="mapping.map.panning">1</option>
            <option name="mapping.map.scrollZoom">0</option>
            <option name="mapping.map.zoom">4</option>
            <option name="mapping.type">choropleth</option>
      </map>
    </panel>
  </row>
</form>

For automatic country switching
Similar as above. Take a look at the "Null search swapper" example in the Splunk 6.x Dashboard Examples app to switch based on the search result

View solution in original post

mporath_splunk
Splunk Employee
Splunk Employee

You can do all of that with the dashboard Link Switcher capabilities:

For manual country switching
- Create a form element with your countries
- Setup a link switcher like the one below

<form>
  <label>Test switcher</label>
  <fieldset submitButton="false">
    <input type="radio" token="country">
      <label>Country</label>
      <choice value="China">China</choice>
      <choice value="US">US</choice>
      <default>China</default>
      <change>
        <condition value="China">
          <set token="showChina">true</set>
          <unset token="showUs"></unset>
        </condition>
        <condition value="US">
          <unset token="showChina"></unset>
          <set token="showUs">true</set>
        </condition>
      </change>
    </input>
  </fieldset>
  <row>
    <panel>
      <title>Current Country</title>
      <map depends="$showUs$">
        <title>$country$</title>
        <search>
          <query>lat lon | head 1000 | lookup geo_countries longitude AS lon, latitude AS lat | stats count by featureId | geom geo_countries</query>
        </search>
            <option name="mapping.map.center">(37.3,-81.65)</option>
            <option name="mapping.map.panning">true</option>
            <option name="mapping.map.scrollZoom">false</option>
            <option name="mapping.map.zoom">4</option>
            <option name="mapping.type">choropleth</option>
            <option name="drilldown">all</option>
      </map>
      <map depends="$showChina$">
        <title>$country$</title>
        <search>
          <query>lat lon | head 1000 | lookup geo_countries longitude AS lon, latitude AS lat | stats count by featureId | geom geo_countries</query>
          <earliest></earliest>
          <latest></latest>
        </search>
            <option name="mapping.map.center">(32.32,103.62)</option>
            <option name="mapping.map.panning">1</option>
            <option name="mapping.map.scrollZoom">0</option>
            <option name="mapping.map.zoom">4</option>
            <option name="mapping.type">choropleth</option>
      </map>
    </panel>
  </row>
</form>

For automatic country switching
Similar as above. Take a look at the "Null search swapper" example in the Splunk 6.x Dashboard Examples app to switch based on the search result

hylam
Contributor

Can I compute the minimum bounding box dynamically from the resultset w/o hardcoding the coordinates and zoom of China and USA? My number of shapes way more than 2. I have custom maps and tile servers.

0 Karma

mporath_splunk
Splunk Employee
Splunk Employee

No, that's not possible right now

0 Karma
Get Updates on the Splunk Community!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...