<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Dashboard Table Visualization rendering of numeric fields in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Dashboard-Table-Visualization-rendering-of-numeric-fields/m-p/545774#M37487</link>
    <description>&lt;P&gt;&lt;BR /&gt;When I see this issue it is in a dashboard table visualization not in the search result.&amp;nbsp; The number is shown correctly as a number (right justified) in search statistics view.&amp;nbsp; Strings are shown left justified by default and numbers are right.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;In my case the issue concerns representing a number as currency in a dashboard.&lt;/P&gt;&lt;P&gt;The generating search ends with something like :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval Amount=round(Amount,2)
| fieldformat Amount=printf("%.2f",Amount)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So there is a clear indication that Amount can only be Null or a number.&amp;nbsp; The eval is not necessary if you want to keep the original value completely in tact - I left it there to demonstrate as I was trying various things to force the table to display my value how I wished.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I use fieldformat since I wish to be able to drilldown on the actual value of Amount and not the string representation.&amp;nbsp; Fieldformat works as intended however as OP noted, table visualization doesn't maintain the intended field's right justification.&lt;/P&gt;&lt;P&gt;To further enhance my dashboard relating to the "Amount" field I&amp;nbsp;have the following.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;        &amp;lt;format type="number" field="Amount"&amp;gt;
          &amp;lt;option name="unit"&amp;gt;$&amp;lt;/option&amp;gt;
          &amp;lt;option name="unitPosition"&amp;gt;before&amp;lt;/option&amp;gt;
        &amp;lt;/format&amp;gt;
        &amp;lt;format type="color" field="Amount"&amp;gt;
          &amp;lt;colorPalette type="list"&amp;gt;[#F1813F,#B6C75A]&amp;lt;/colorPalette&amp;gt;
          &amp;lt;scale type="threshold"&amp;gt;9.999&amp;lt;/scale&amp;gt;
        &amp;lt;/format&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My field should be right justified since I have "told" the table visualization it's a number in the specific way that is documented and the base search has resulted in the field being denoted with 'numeric' td class anyhow.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;By this reasoning it's a bug because "table visualization does not respect numeric field right justification CSS directive".&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;STRONG&gt;My hack solution for dashboard:&lt;/STRONG&gt;&lt;BR /&gt;Of interest to me is that when I examine the html of the generated dashboard, the field in question is denoted with class=td.numeric which includes text-align:right however it's then overridden by the table class from dahsboard itself.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="css"&gt;.table tr, .table td, .table th {
    font-family: Roboto,Droid,Helvetica Neue,Helvetica,Arial,sans-serif;
    font-size: 12px;
    line-height: 16px;
    text-align: left;
    padding: 4px 8px;
}

td.numeric, th.numeric {
    text-align: right;
}​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;So this leads to a simple hack which solves the visualization issue for me.&amp;nbsp; Perhaps it will solve for others.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;    &amp;lt;row&amp;gt;
      &amp;lt;html depends="$nothing$"&amp;gt;
        &amp;lt;style type="text/css"&amp;gt;
          td.numeric, th.numeric { text-align: right !important; }
        &amp;lt;/style&amp;gt; 
      &amp;lt;/html&amp;gt;
    &amp;lt;/row&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;I assume the CSS defined within the dashboard xml has precedence over the generated CSS which is very handy indeed.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This will result in any numeric field in a table visualization in a dashboard maintaining the right justification that the developer of the table view in statistics view intended.&amp;nbsp; Probably when that enhancement was made, no thought was given to the dashboard table visualization issue.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Full dashboard example with hack&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;dashboard&amp;gt;
  &amp;lt;label&amp;gt;test3&amp;lt;/label&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;table&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;
| makeresults 
| eval Amount=1234.5678
| fieldformat Amount1=printf("%.2f",Amount)
| fieldformat Amount2=printf("$%.2f",Amount)
| fieldformat Amount3=printf("%12.2f",Amount)
| fieldformat Amount4=printf("$%12.2f",Amount)
| eval x1=Amount
        &amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;1616708511&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;1616709413.085&amp;lt;/latest&amp;gt;
          &amp;lt;sampleRatio&amp;gt;1&amp;lt;/sampleRatio&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="count"&amp;gt;100&amp;lt;/option&amp;gt;
        &amp;lt;option name="dataOverlayMode"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="percentagesRow"&amp;gt;false&amp;lt;/option&amp;gt;
        &amp;lt;option name="rowNumbers"&amp;gt;false&amp;lt;/option&amp;gt;
        &amp;lt;option name="totalsRow"&amp;gt;false&amp;lt;/option&amp;gt;
        &amp;lt;option name="wrap"&amp;gt;true&amp;lt;/option&amp;gt;
        

        
        &amp;lt;format type="number" field="Amount1"&amp;gt;
          &amp;lt;option name="unit"&amp;gt;$&amp;lt;/option&amp;gt;
          &amp;lt;option name="unitPosition"&amp;gt;before&amp;lt;/option&amp;gt;
        &amp;lt;/format&amp;gt;
        &amp;lt;format type="color" field="Amount1"&amp;gt;
          &amp;lt;colorPalette type="list"&amp;gt;[#F1813F,#B6C75A]&amp;lt;/colorPalette&amp;gt;
          &amp;lt;scale type="threshold"&amp;gt;9.999&amp;lt;/scale&amp;gt;
        &amp;lt;/format&amp;gt; 
        
        &amp;lt;format type="number" field="Amount2"&amp;gt;
          &amp;lt;option name="unit"&amp;gt;$&amp;lt;/option&amp;gt;
          &amp;lt;option name="unitPosition"&amp;gt;before&amp;lt;/option&amp;gt;
        &amp;lt;/format&amp;gt;
        &amp;lt;format type="color" field="Amount2"&amp;gt;
          &amp;lt;colorPalette type="list"&amp;gt;[#F1813F,#B6C75A]&amp;lt;/colorPalette&amp;gt;
          &amp;lt;scale type="threshold"&amp;gt;9.999&amp;lt;/scale&amp;gt;
        &amp;lt;/format&amp;gt; 
        
        &amp;lt;format type="number" field="Amount3"&amp;gt;
          &amp;lt;option name="unit"&amp;gt;$&amp;lt;/option&amp;gt;
          &amp;lt;option name="unitPosition"&amp;gt;before&amp;lt;/option&amp;gt;
        &amp;lt;/format&amp;gt;
        &amp;lt;format type="color" field="Amount3"&amp;gt;
          &amp;lt;colorPalette type="list"&amp;gt;[#F1813F,#B6C75A]&amp;lt;/colorPalette&amp;gt;
          &amp;lt;scale type="threshold"&amp;gt;9.999&amp;lt;/scale&amp;gt;
        &amp;lt;/format&amp;gt;

        &amp;lt;format type="number" field="Amount4"&amp;gt;
          &amp;lt;option name="unit"&amp;gt;$&amp;lt;/option&amp;gt;
          &amp;lt;option name="unitPosition"&amp;gt;before&amp;lt;/option&amp;gt;
        &amp;lt;/format&amp;gt;
        &amp;lt;format type="color" field="Amount4"&amp;gt;
          &amp;lt;colorPalette type="list"&amp;gt;[#F1813F,#B6C75A]&amp;lt;/colorPalette&amp;gt;
          &amp;lt;scale type="threshold"&amp;gt;9.999&amp;lt;/scale&amp;gt;
        &amp;lt;/format&amp;gt;         
        
      &amp;lt;/table&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
  
  &amp;lt;row&amp;gt;
    &amp;lt;html depends="$nothing$"&amp;gt;
      &amp;lt;style type="text/css"&amp;gt;
        td.numeric, th.numeric { text-align: right !important; }
      &amp;lt;/style&amp;gt; 
    &amp;lt;/html&amp;gt;
  &amp;lt;/row&amp;gt;   
 
&amp;lt;/dashboard&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note that Amount3 is rendered as string although it's being colored correctly as a number so it's a weird one.&amp;nbsp; The table visualization is troubled by printf's attempt to left pad the value and ignores the padding however still thinks of the value as numeric in terms of the type="color" format block.&lt;BR /&gt;&lt;BR /&gt;Finally my question:&lt;BR /&gt;Is there something I've missed or a better way to handle this simple requirement?&amp;nbsp; I want the dashboard table visualization to render numbers the same way as the search statistic view.&lt;/P&gt;</description>
    <pubDate>Sun, 28 Mar 2021 20:34:59 GMT</pubDate>
    <dc:creator>pclewis</dc:creator>
    <dc:date>2021-03-28T20:34:59Z</dc:date>
    <item>
      <title>Dashboard Table Visualization rendering of numeric fields</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Dashboard-Table-Visualization-rendering-of-numeric-fields/m-p/545774#M37487</link>
      <description>&lt;P&gt;&lt;BR /&gt;When I see this issue it is in a dashboard table visualization not in the search result.&amp;nbsp; The number is shown correctly as a number (right justified) in search statistics view.&amp;nbsp; Strings are shown left justified by default and numbers are right.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;In my case the issue concerns representing a number as currency in a dashboard.&lt;/P&gt;&lt;P&gt;The generating search ends with something like :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval Amount=round(Amount,2)
| fieldformat Amount=printf("%.2f",Amount)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So there is a clear indication that Amount can only be Null or a number.&amp;nbsp; The eval is not necessary if you want to keep the original value completely in tact - I left it there to demonstrate as I was trying various things to force the table to display my value how I wished.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I use fieldformat since I wish to be able to drilldown on the actual value of Amount and not the string representation.&amp;nbsp; Fieldformat works as intended however as OP noted, table visualization doesn't maintain the intended field's right justification.&lt;/P&gt;&lt;P&gt;To further enhance my dashboard relating to the "Amount" field I&amp;nbsp;have the following.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;        &amp;lt;format type="number" field="Amount"&amp;gt;
          &amp;lt;option name="unit"&amp;gt;$&amp;lt;/option&amp;gt;
          &amp;lt;option name="unitPosition"&amp;gt;before&amp;lt;/option&amp;gt;
        &amp;lt;/format&amp;gt;
        &amp;lt;format type="color" field="Amount"&amp;gt;
          &amp;lt;colorPalette type="list"&amp;gt;[#F1813F,#B6C75A]&amp;lt;/colorPalette&amp;gt;
          &amp;lt;scale type="threshold"&amp;gt;9.999&amp;lt;/scale&amp;gt;
        &amp;lt;/format&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My field should be right justified since I have "told" the table visualization it's a number in the specific way that is documented and the base search has resulted in the field being denoted with 'numeric' td class anyhow.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;By this reasoning it's a bug because "table visualization does not respect numeric field right justification CSS directive".&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;STRONG&gt;My hack solution for dashboard:&lt;/STRONG&gt;&lt;BR /&gt;Of interest to me is that when I examine the html of the generated dashboard, the field in question is denoted with class=td.numeric which includes text-align:right however it's then overridden by the table class from dahsboard itself.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="css"&gt;.table tr, .table td, .table th {
    font-family: Roboto,Droid,Helvetica Neue,Helvetica,Arial,sans-serif;
    font-size: 12px;
    line-height: 16px;
    text-align: left;
    padding: 4px 8px;
}

td.numeric, th.numeric {
    text-align: right;
}​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;So this leads to a simple hack which solves the visualization issue for me.&amp;nbsp; Perhaps it will solve for others.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;    &amp;lt;row&amp;gt;
      &amp;lt;html depends="$nothing$"&amp;gt;
        &amp;lt;style type="text/css"&amp;gt;
          td.numeric, th.numeric { text-align: right !important; }
        &amp;lt;/style&amp;gt; 
      &amp;lt;/html&amp;gt;
    &amp;lt;/row&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;I assume the CSS defined within the dashboard xml has precedence over the generated CSS which is very handy indeed.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This will result in any numeric field in a table visualization in a dashboard maintaining the right justification that the developer of the table view in statistics view intended.&amp;nbsp; Probably when that enhancement was made, no thought was given to the dashboard table visualization issue.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Full dashboard example with hack&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;dashboard&amp;gt;
  &amp;lt;label&amp;gt;test3&amp;lt;/label&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;table&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;
| makeresults 
| eval Amount=1234.5678
| fieldformat Amount1=printf("%.2f",Amount)
| fieldformat Amount2=printf("$%.2f",Amount)
| fieldformat Amount3=printf("%12.2f",Amount)
| fieldformat Amount4=printf("$%12.2f",Amount)
| eval x1=Amount
        &amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;1616708511&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;1616709413.085&amp;lt;/latest&amp;gt;
          &amp;lt;sampleRatio&amp;gt;1&amp;lt;/sampleRatio&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="count"&amp;gt;100&amp;lt;/option&amp;gt;
        &amp;lt;option name="dataOverlayMode"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="percentagesRow"&amp;gt;false&amp;lt;/option&amp;gt;
        &amp;lt;option name="rowNumbers"&amp;gt;false&amp;lt;/option&amp;gt;
        &amp;lt;option name="totalsRow"&amp;gt;false&amp;lt;/option&amp;gt;
        &amp;lt;option name="wrap"&amp;gt;true&amp;lt;/option&amp;gt;
        

        
        &amp;lt;format type="number" field="Amount1"&amp;gt;
          &amp;lt;option name="unit"&amp;gt;$&amp;lt;/option&amp;gt;
          &amp;lt;option name="unitPosition"&amp;gt;before&amp;lt;/option&amp;gt;
        &amp;lt;/format&amp;gt;
        &amp;lt;format type="color" field="Amount1"&amp;gt;
          &amp;lt;colorPalette type="list"&amp;gt;[#F1813F,#B6C75A]&amp;lt;/colorPalette&amp;gt;
          &amp;lt;scale type="threshold"&amp;gt;9.999&amp;lt;/scale&amp;gt;
        &amp;lt;/format&amp;gt; 
        
        &amp;lt;format type="number" field="Amount2"&amp;gt;
          &amp;lt;option name="unit"&amp;gt;$&amp;lt;/option&amp;gt;
          &amp;lt;option name="unitPosition"&amp;gt;before&amp;lt;/option&amp;gt;
        &amp;lt;/format&amp;gt;
        &amp;lt;format type="color" field="Amount2"&amp;gt;
          &amp;lt;colorPalette type="list"&amp;gt;[#F1813F,#B6C75A]&amp;lt;/colorPalette&amp;gt;
          &amp;lt;scale type="threshold"&amp;gt;9.999&amp;lt;/scale&amp;gt;
        &amp;lt;/format&amp;gt; 
        
        &amp;lt;format type="number" field="Amount3"&amp;gt;
          &amp;lt;option name="unit"&amp;gt;$&amp;lt;/option&amp;gt;
          &amp;lt;option name="unitPosition"&amp;gt;before&amp;lt;/option&amp;gt;
        &amp;lt;/format&amp;gt;
        &amp;lt;format type="color" field="Amount3"&amp;gt;
          &amp;lt;colorPalette type="list"&amp;gt;[#F1813F,#B6C75A]&amp;lt;/colorPalette&amp;gt;
          &amp;lt;scale type="threshold"&amp;gt;9.999&amp;lt;/scale&amp;gt;
        &amp;lt;/format&amp;gt;

        &amp;lt;format type="number" field="Amount4"&amp;gt;
          &amp;lt;option name="unit"&amp;gt;$&amp;lt;/option&amp;gt;
          &amp;lt;option name="unitPosition"&amp;gt;before&amp;lt;/option&amp;gt;
        &amp;lt;/format&amp;gt;
        &amp;lt;format type="color" field="Amount4"&amp;gt;
          &amp;lt;colorPalette type="list"&amp;gt;[#F1813F,#B6C75A]&amp;lt;/colorPalette&amp;gt;
          &amp;lt;scale type="threshold"&amp;gt;9.999&amp;lt;/scale&amp;gt;
        &amp;lt;/format&amp;gt;         
        
      &amp;lt;/table&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
  
  &amp;lt;row&amp;gt;
    &amp;lt;html depends="$nothing$"&amp;gt;
      &amp;lt;style type="text/css"&amp;gt;
        td.numeric, th.numeric { text-align: right !important; }
      &amp;lt;/style&amp;gt; 
    &amp;lt;/html&amp;gt;
  &amp;lt;/row&amp;gt;   
 
&amp;lt;/dashboard&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note that Amount3 is rendered as string although it's being colored correctly as a number so it's a weird one.&amp;nbsp; The table visualization is troubled by printf's attempt to left pad the value and ignores the padding however still thinks of the value as numeric in terms of the type="color" format block.&lt;BR /&gt;&lt;BR /&gt;Finally my question:&lt;BR /&gt;Is there something I've missed or a better way to handle this simple requirement?&amp;nbsp; I want the dashboard table visualization to render numbers the same way as the search statistic view.&lt;/P&gt;</description>
      <pubDate>Sun, 28 Mar 2021 20:34:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Dashboard-Table-Visualization-rendering-of-numeric-fields/m-p/545774#M37487</guid>
      <dc:creator>pclewis</dc:creator>
      <dc:date>2021-03-28T20:34:59Z</dc:date>
    </item>
  </channel>
</rss>

