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!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...