Dashboards & Visualizations

Passing token to chart overlay

mdunnavant
Observer

I've searched and searched on this and it's time to just ask the question.

I want to create a simple transaction count bar overlayed with the average duration line.  I can do this when hard setting the transaction name. 

mdunnavant_0-1596027006173.pngmdunnavant_1-1596027044699.png

 

 

However, when I try to generate an overlay using a dropdown of transaction names there is no overlay.  I feel like I'm just not passing a correctly formatted token to charting.chart.overlayFields option.

mdunnavant_2-1596027129372.pngmdunnavant_3-1596027161918.png

 

I've tried,

  • <option name="charting.chart.overlayFields">"avg(duration):" $ID$</option>
  • <option name="charting.chart.overlayFields">$ID$</option>
  • <option name="charting.chart.overlayFields">avg(duration): $ID$</option>
  • and probably dozens more as I'm throwing darts.

Any ideas here?

Labels (2)
0 Karma

bowesmana
SplunkTrust
SplunkTrust

It does work

See this example row/panel that creates some pseudo data and simulates what you're trying to do

  <row>
    <panel>
      <input type="dropdown" token="func_option">
        <label>Func</label>
        <choice value="Func1">Func1</choice>
        <choice value="Func2">Func2</choice>
        <choice value="Func3">Func3</choice>
      </input>
      <chart>
        <search>
          <query>| makeresults count=1000
| eval _time=_time-random() % 3600
| eval Func=mvindex(split("Func1,Func2,Func3",","), random() % 3)
| eval duration=random() % 1000000 / 1000
| timechart fixedrange=t count avg(duration) by Func
| fields _time avg*$func_option$ count*</query>
          <earliest>-60m@m</earliest>
          <latest>now</latest>
          <sampleRatio>1</sampleRatio>
        </search>
        <option name="charting.axisLabelsX.majorLabelStyle.overflowMode">ellipsisNone</option>
        <option name="charting.axisLabelsX.majorLabelStyle.rotation">0</option>
        <option name="charting.axisTitleX.visibility">visible</option>
        <option name="charting.axisTitleY.visibility">visible</option>
        <option name="charting.axisTitleY2.visibility">visible</option>
        <option name="charting.axisX.abbreviation">none</option>
        <option name="charting.axisX.scale">linear</option>
        <option name="charting.axisY.abbreviation">none</option>
        <option name="charting.axisY.scale">linear</option>
        <option name="charting.axisY2.abbreviation">none</option>
        <option name="charting.axisY2.enabled">1</option>
        <option name="charting.axisY2.scale">inherit</option>
        <option name="charting.chart">column</option>
        <option name="charting.chart.bubbleMaximumSize">50</option>
        <option name="charting.chart.bubbleMinimumSize">10</option>
        <option name="charting.chart.bubbleSizeBy">area</option>
        <option name="charting.chart.nullValueMode">gaps</option>
        <option name="charting.chart.overlayFields">"avg(duration): $func_option$"</option>
        <option name="charting.chart.showDataLabels">none</option>
        <option name="charting.chart.sliceCollapsingThreshold">0.01</option>
        <option name="charting.chart.stackMode">default</option>
        <option name="charting.chart.style">shiny</option>
        <option name="charting.drilldown">none</option>
        <option name="charting.layout.splitSeries">0</option>
        <option name="charting.layout.splitSeries.allowIndependentYRanges">0</option>
        <option name="charting.legend.labelStyle.overflowMode">ellipsisMiddle</option>
        <option name="charting.legend.mode">standard</option>
        <option name="charting.legend.placement">right</option>
        <option name="charting.lineWidth">2</option>
        <option name="refresh.display">progressbar</option>
        <option name="trellis.enabled">0</option>
        <option name="trellis.scales.shared">1</option>
        <option name="trellis.size">medium</option>
      </chart>
    </panel>
  </row>

I can choose the Func dropdown and it will make that particular Func as the chart overlay using the token

bowesmana_0-1713827487043.png

 

0 Karma

sanjai
Path Finder

Hi  @mdunnavant ,

I noticed you were working on passing a token to chart overlay. I'm encountering a similar issue where I'm trying to pass a token value to overlay options for line chart representation over a column chart. If you've managed to achieve this, could you please share how you made it overlay with a token value? Your insights would be greatly appreciated.

My Chart and My SPL query:

sanjai_0-1713760567981.png

SPL:

index=development sourcetype=rwa_custom_function user_action=swmfs_test ds_file=*
| eval ds_file_path=ds_path."\\".ds_file
| chart avg(ms_per_block) as avg_processing_time_per_block over ds_file_path by machine
| appendcols
[search index=development sourcetype=rwa_custom_function user_action=swmfs_test ds_file=*
| eval ds_file_path=ds_path."\\".ds_file
| stats max(block_count) as total_blocks by ds_file_path]


sanjai_2-1713761136505.png

 

I need to assign the overlay field value from the line in SPL:


| chart avg(ms_per_block) as avg_processing_time_per_block over ds_file_path by machine

The reason I'm attempting to assign it as a token is that the avg_processing_time_per_block has dynamic values (sometimes it may be 10 or 12).instead of rwmini and rwws01.

Thanks In advance,

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
0 Karma
Get Updates on the Splunk Community!

Your Guide to Splunk Digital Experience Monitoring

A flawless digital experience isn't just an advantage, it's key to customer loyalty and business success. But ...

Data Management Digest – November 2025

  Welcome to the inaugural edition of Data Management Digest! As your trusted partner in data innovation, the ...

Upcoming Webinar: Unmasking Insider Threats with Slunk Enterprise Security’s UEBA

Join us on Wed, Dec 10. at 10AM PST / 1PM EST for a live webinar and demo with Splunk experts! Discover how ...