Dashboards & Visualizations

Displaying one column value as tooltip to another column for a table

AKG1_old1
Builder

Hi,

I am using one table in my dashboard. if possible I wanted to display one column values as tooltip to another column.

basically in below table Threshold value need to be displayed as tooltip when mouse rollover on Alert_Destription or Issues_Count.

alt text

0 Karma

vnravikumar
Champion

Hi

Check @kamlesh_vaghela solution in the below link.

https://answers.splunk.com/answers/705538/how-can-i-display-hidden-fields-in-a-tooltip-1.html

or

<dashboard script="tooltip.js">
  <label>tooltip</label>
  <row>
    <panel>
      <table id="rk">
        <search>
          <query>| makeresults 
| eval Alert_Description="CPU Issues (Avg Over 70% in 10mins)", Issues_Count=0,Threshold=70,Dashboard="CPU" 
| append 
    [| makeresults 
    | eval Alert_Description="GC Issues (Stop the world >= 20%)", Issues_Count=0,Threshold=20,Dashboard="GC"] 
| eval Alert_Description=Alert_Description."##".Threshold,Issues_Count=Issues_Count."##".Threshold 
| table Alert_Description,Issues_Count,Threshold,Dashboard</query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
        </search>
        <option name="drilldown">none</option>
      </table>
    </panel>
  </row>
</dashboard>

javascript:

require([
    'underscore',
    'jquery',
    'splunkjs/mvc',
    'splunkjs/mvc/tableview',
    'splunkjs/mvc/simplexml/ready!'
], function(_, $, mvc, TableView) {

    var CustomRangeRenderer = TableView.BaseCellRenderer.extend({
        canRender: function(cell) {

            return _([ 'Alert_Description','Issues_Count']).contains(cell.field);
        },
        render: function($td, cell) {
            var value = cell.value.split("##")[0];
            var tooltip = cell.value.split("##")[1];
            $td.attr('title', tooltip);
            $td.text(value);
           if(cell.field==='Issues_Count'){
                $td.text(value).addClass('numeric');
           }else{
                $td.text(value).addClass('string');
           }
        }
    });
    mvc.Components.get('rk').getVisualization(function(tableView) {
        tableView.table.addCellRenderer(new CustomRangeRenderer());
        tableView.on('rendered', function() {
            tableView.$el.find('td.range-cell').each(function() {
                $(this).parents('tr').addClass(this.className);
            });
        });
        tableView.table.render();
    });
});
0 Karma

vnravikumar
Champion

Hi @agoyal

Please try the above solutions and let us know.

0 Karma
Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

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 GA in US-AWS!

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