All Apps and Add-ons

Table field colour in simple xml dashboard does not work

Sukisen1981
Champion

Hi, I have a stats table saved as a panel in a dashboard. I want to colour the 'Category' row based on its field values - Red, Amber or Green. Below is the simple XML code. However no colour gets applied to the table in the dashboard.......Please help

test

<panel>
  <table>
    <search>
      <query>index="vc" |eval Category=case(Availability >=99,"3",Availability >=98 AND Availability <99,"2",Availability < 98 , "1" ) |head 11 | table Category,VCNumber,Availability | sort Category,VCNumber|eval Category=case(Category="1", "Red",Category="2", "Amber",Category="3","Green" )</query>
    </search>
            <option name="count">5</option>
    <option name="dataOverlayMode">none</option>
    <option name="drilldown">false</option>
    <option name="percentagesRow">false</option>
    <option name="rowNumbers">false</option>
    <option name="totalsRow">false</option>
    <option name="wrap">true</option>
    <format type="color" field="Category">
      <colorPalette type="map">{"Red" :#FF7F50,"Amber" :#ff9c20,"Green" :#ffe000}</colorPalette>
    </format>


  </table>
</panel>
0 Karma

niketn
Legend

@Sukisen1981, are you on Splunk Enterprise version 6.5 or higher? You color hex code are off but it should still get applied. If you are on 6.5 or higher, you can Edit Panel and then apply custom column color by values directly.
Color code should look like the following.

    <format type="color" field="Category">
      <colorPalette type="map">{"Red":#D93F3C,"Amber":#F7BC38,"Green":#65A637}</colorPalette>
    </format>

If you are on 6.4 or previous version or are using HTML dashboard, you will have to use JavaScript code to apply colors. Get the Splunk Dashboard Examples app (https://splunkbase.splunk.com/app/1603/) to see the Table Cell Highlighting example for Table cell Color by cell value.

Refer to documentation:
https://docs.splunk.com/Documentation/Splunk/latest/Viz/TableFormatsFormatting#Column_color
https://docs.splunk.com/Documentation/Splunk/latest/Viz/TableFormatsXML#Color_palette_types_and_opti...

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

Sukisen1981
Champion

i am on 6.4.1
Note - I have a pie chart also in the dashboard and this works very well-
{"Red":0xd13b3b,"Amber":f7912c, "Green":0x7e9f44}
BUT
when i try applying the same to a stats table it does not colour the rows, the pie chart however takes the colours as specified

0 Karma

niketn
Legend

The Simple XML Chart configuration charting.fieldColors is applicable on Charts (like Column, bar, pie etc) but not on table. Splunk Dashboard Examples app has two examples to color cell by value or color by row. Please install the app and try them out.

Refer to one of my answers on Similar line to color row based on value. Please try out and confirm.
https://answers.splunk.com/answers/588394/change-the-color-of-rows-in-a-table-based-on-text-1.html

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma
Get Updates on the Splunk Community!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

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