In Splunk studio, I have a Status field with the values DROPPED and NOT DROPPED. If I get Dropped the background color of the card should change into Green... If the field value is NOT DROPPED. It should be Red. How can I achieve it in splunk studio.
Thanks
You can use the dynamic element color
https://docs.splunk.com/Documentation/Splunk/9.2.1/DashStudio/ModifyDOS
select background and set the color based on the status
Here is a run anywhere example
Just change the status in the dropdown and you can see the color changes
{
"visualizations": {
"viz_NJsTjQl4": {
"type": "splunk.singlevalue",
"options": {
"backgroundColor": "> majorValue | matchValue(backgroundColorEditorConfig)",
"majorColor": "#ffffff"
},
"dataSources": {
"primary": "ds_275I8YNY"
},
"context": {
"backgroundColorEditorConfig": [
{
"match": "Stopped",
"value": "#ad3f20"
},
{
"match": "Running",
"value": "#207865"
}
]
}
}
},
"dataSources": {
"ds_275I8YNY": {
"type": "ds.search",
"options": {
"query": "| makeresults\n| eval value=\"$status$\""
},
"name": "Search_1"
}
},
"defaults": {
"dataSources": {
"ds.search": {
"options": {
"queryParameters": {
"latest": "$global_time.latest$",
"earliest": "$global_time.earliest$"
}
}
}
}
},
"inputs": {
"input_global_trp": {
"type": "input.timerange",
"options": {
"token": "global_time",
"defaultValue": "-24h@h,now"
},
"title": "Global Time Range"
},
"input_BHJAbWl2": {
"options": {
"items": [
{
"label": "Running",
"value": "Running"
},
{
"label": "Stopped",
"value": "Stopped"
}
],
"token": "status",
"selectFirstSearchResult": true
},
"title": "Status",
"type": "input.dropdown"
}
},
"layout": {
"type": "grid",
"options": {
"width": 1440,
"height": 960
},
"structure": [
{
"item": "viz_NJsTjQl4",
"type": "block",
"position": {
"x": 0,
"y": 0,
"w": 1440,
"h": 400
}
}
],
"globalInputs": [
"input_global_trp",
"input_BHJAbWl2"
]
},
"description": "",
"title": "single_panel_studio"
}