Dashboards & Visualizations

How to add color to table rows in Dashboard Studio?

bamartinez
Explorer

Hello!

I am looking to add color to a table I have in Dashboard Studio. I notice in the UI there are no coloring options when you select Column Formatting for a string type - the color formats only show for number types. So I tried to replicate the color formatting onto a string type via the source code but am not getting anywhere.

Is there something I am missing? Is this possible to color strings in tables with the current release of dashboard studio?

TIA!

Labels (1)
Tags (2)

jasonlashua
Loves-to-Learn

oooh can doo!

Format a column first, and make a range map or value match then take note of that in the code, for instance the "Users in group" column:

 "Users in Group": { "data": "> table | seriesByName(\"Users in Group\") | formatByType(Users_in_GroupColumnFormatEditorConfig)",
"rowColors": "> table | seriesByName('Users in Group') | pick(Users_in_GroupRowColorsEditorConfig)",
"rowBackgroundColors": "> table | seriesByName(\"Users in Group\") | rangeValue(Users_in_GroupRowBackgroundColorsEditorConfig)" } 

 
Then find tableFormat and change rowBackgroundColors to the same as you used to color the column

"headerVisibility": "fixed",
"backgroundColor": "transparent",
"tableFormat": {
    "rowBackgroundColors": "> table | seriesByName('Users in Group') | rangeValue(Users_in_GroupRowBackgroundColorsEditorConfig)",
    "headerBackgroundColor": "> backgroundColor | setColorChannel(tableHeaderBackgroundColorConfig)",
    "rowColors": "> rowBackgroundColors | maxContrast(tableRowColorMaxContrast)",
    "headerColor": "> headerBackgroundColor | maxContrast(tableRowColorMaxContrast)" } 

And the whole row is now that color. 

 

 

0 Karma

RedPooch
Engager

As you see adding to colors to number columns in Dashboard Studio is straightforward via GUI editor for numbered fields.   To add colors to a column based on a value you need to do it in the source .json of the dashboard.

In my example, I created a table with a column name of "Status", which has the values of Success, Warning, Failed or Running.  I wanted to change the color of the cell based on the value.

Here is what I did in the Dashboard source under "Visualizations" (skip down the section "Column Format:) 

    "visualizations": {
        "viz_table_1": {
            "type""splunk.table",
            "options": {
.......(many option fields).....
 
                "columnFormat": {
                    "Status": {
                        "rowBackgroundColors""> table | seriesByName('Status') | matchValue(matchConfig)"
                    },
 
            "dataSources": {
                "primary""ds_search_1"
            },
            "context": {
                "tableRowBackgroundColors": [
                    "#2C3033",
                    "#32373D"
                ],
                "tableRowColor": [
                    "#A870EF"
                ],
                "matchConfig": [
                    {
                        "match""Success",
                        "value""#53A051"
                    },
                    {
                        "match""Warning",
                        "value""#B6C75A"
                    },
                    {
                        "match""Failed",
                        "value""#DC4E41"
                    },
                    {
                        "match""Running",
                        "value""#006D9C"
                    }
                ]
 
 
I'd recommend looking at the Example Hub  under Search>Dashboards>Examples for Dashboard Studio" in the Splunk UI.  Hope it points you down the right path.

nayagan
Engager

It is more helpful but we need to highlight entire row based on the column values success, warning, failed and running. 

In your code only highlight particular cell not entire row. More appreciated if you are providing the json code for the same. 

Tags (1)
0 Karma

Augus123
New Member

Hi,

I am looking to edit my dashboard (Studio) - to color code a column based on certain values (non-numeric)

Same here...I am just looking for the JS code to add it to visualization part of the source code

Field name is "Game Status". The values in this columns and their respective color codes:
"Completed" to be in Blue, "on-line" to be in "Green" and "Not available" to be in "Red"

0 Karma

SteveM-905
Loves-to-Learn

Me too

0 Karma
Get Updates on the Splunk Community!

Cisco Use Cases, ITSI Best Practices, and More New Articles from Splunk Lantern

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

Build Your First SPL2 App!

Watch the recording now!.Do you want to SPL™, too? SPL2, Splunk's next-generation data search and preparation ...

Exporting Splunk Apps

Join us on Monday, October 21 at 11 am PT | 2 pm ET!With the app export functionality, app developers and ...