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>
@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...
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
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