Dashboards & Visualizations

Change Color of Sparkline in Dashboard Studio

gabbydm
Explorer

Hello,

I am trying to change the color of the sparkline in my table. I don't have the option to change it using the dropdown menu under "Column-specific formatting" so I'm trying to do it through he Code option. Here is the current code I have: 

{
"type": "splunk.table",
"dataSources": {
"primary": "ds_xNY7uyLU"
},
"title": "Top Notable Sources",
"options": {
"fontSize": "extraSmall",
"columnFormat": {
"sparkline": {
"data": "> table | seriesByName(\"sparkline\") | formatByType(sparklineColumnFormatEditorConfig)",
"sparklineColors": "> table | seriesByName(\"sparkline\") | matchValue(sparklineColorsEditorConfig)"
}
}
},
"context": {
"sparklineColorsEditorConfig": [
{
"string": {},
"value": "#66aaf9"
}
]
},
"showProgressBar": false,
"showLastUpdated": false
}

 

Labels (2)
0 Karma
1 Solution

tej57
Communicator

Hello @gabbydm ,

You can use the following parameters to change the sparkline color from the editor.

sparklineColors
sparklineAreaColors

Note that you can define the cellType to SparklineCell for such visualization.

Reference document - https://docs.splunk.com/Documentation/SplunkCloud/9.0.2305/DashStudio/objOptRef#columnFormat_.28obje...

 

Thanks,
Tejas.

 

---

If the above solution helps you, an upvote is appreciated.

View solution in original post

gabbydm
Explorer

That worked! Thank you for the help!

0 Karma

PaulH
New Member

Hi, can you post a sample code of your solution?

I can't figure it out. 🙂

0 Karma

gabbydm
Explorer

I ended up just adding the hex code of my preferred colors to the options section of the visualization:

 

"viz_AbCd12if": {
            "type": "splunk.table",
            "dataSources": {
                "primary": "ds_xNY7uyLU"
            },
            "title": "Title of Table",
            "options": {
                "columnFormat": {
                    "sparkline": {
                        "data": "> table | seriesByName(\"sparkline\") | formatByType(sparklineColumnFormatEditorConfig)",
                        "sparklineColors": [
                            "#66aaf9",
                            "#66aaf9",
                            "#66aaf9",
                            "#66aaf9",
                            "#66aaf9",
                            "#66aaf9",
                            "#66aaf9",
                            "#66aaf9",
                            "#66aaf9",
                            "#66aaf9"
0 Karma

tej57
Communicator

Hello @gabbydm ,

You can use the following parameters to change the sparkline color from the editor.

sparklineColors
sparklineAreaColors

Note that you can define the cellType to SparklineCell for such visualization.

Reference document - https://docs.splunk.com/Documentation/SplunkCloud/9.0.2305/DashStudio/objOptRef#columnFormat_.28obje...

 

Thanks,
Tejas.

 

---

If the above solution helps you, an upvote is appreciated.

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