Dashboards & Visualizations

How do I add color format to HTML dashboard?

Moonveil
Explorer

Hello,

I converted a XML dashboard to HTML in Splunk 6.5, and noticed that the color format for my table is missing after the conversion. The original code in XML is as follows:

      <table id="table1">
        <search id="search1">
        ...
        </search>
        ...
        <format type="color" field="priority">
          <colorPalette type="map">{"info":#5378AD,"low":#98BF3B,"medium":#F0BE1B,"high":#FF8800,"critical":#D25B3B}</colorPalette>
        </format>
      </table>

Can someone tell me how to add color formatting to the converted HTML dashboard? Do I just add it to the table1 TableElement properties?

Thank you!

akarivaratharaj
Communicator

@here I have a similar issue with adding the HTML code for Splunk dashboard. The code is to set the color to a specific field in a panel with table representation.
I have added the below code, which is working fine for the number field

<format type="color" field="COUNT">
    <colorPalette type="minMidMax" maxColor="#D6563C" minColor="#FFFFFF">
    </colorPalette>
    <scale type="minMidMax"></scale>
    </format>

I would like to add the same code for a field which represents the time duration in the format of "HH:MM:SS". The above code is not supporting the time format.

Could anyone please help me in getting the right code to support the time format fields also.

0 Karma

sfatnass
Contributor

hi

the format option still does not work in html.

i need to use a scale coloration for a dynamic table. but it's impossible for me to define a value.

0 Karma

niketn
Legend

After converting to HTML seems like options remains empty in HTML, so seems like a bug.
"format": {"log_level": [{"type": "color", "options": {}}]},

The only example I found was for sparkline options for TableElement, and no information available for colorPalette {"INFO":#5378AD,"ERROR":#98BF3B,"WARN":#F0BE1B}. Since, the SplunkJS reference talks only about setting sparkline and not colorPalette through TableView/TableElement, I was unable to find what exact code to be put in options. Splunk should fix this and also update the Web Framework Documentation.

In your situation, I would suggest use Table Cell Highlighting example from the Simple XML Examples App to color the priority field based on values. The example use Simple XML Extensions, to introduce a custom cell render for the Table View using CSS to apply colors for specific cell values. See if that solves the need.

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

frobinson_splun
Splunk Employee
Splunk Employee

Editing table formats after converting to HTML is not an officially supported usage.

Hope this helps!

Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...