Spread our blog

How to Change the Background Color of a Chart in Splunk

Hi guys !! Again  we have come with a very interesting topic of Splunk. For visualizing the data in Splunk Dashboards we often use column charts , bar charts and pie charts etc. The background of every panel appears white by default.

Have you ever thought of changing the background color of the charts in Splunk ????

In this post we will show you how to change the background color of a chart in splunk. It is very easy to implement. We have created a sample dashboard called Background Color.

back1

Here we have created a panel with a column chart . The query behind the panel is

index=_internal sourcetype=splunkd_ui_access | stats count by method,status

Below we have shown how to change the background color of a chart in Splunk. For that you have to edit the source code of your dashboard. You can see the Edit option on the top right corner of your dashboard. Click on Edit.

back2

Now you can see the Source option on the top left corner of the page. Click on Source to edit the source code.

back3

Now in the source code, you have to add options inside the chart tag.

<option name="charting.fieldColors">
{"status":#FF0000,"count":#00009C}</option>
<option name="charting.backgroundColor">#00FFFF</option>
<option name="charting.fontColor">#000000</option>
<option name="charting.foregroundColor">#000000</option>

By charting.fieldColors we have changed the color of the columns in the chart. Here status and count are two existing field name in the column chart. You can see How to Add Custom Colors in the Charts in Splunk for more details. We have used charting.backgroundColor to change the background color of the column chart. Also, you have to specify the hexadecimal code of the colors to change the background color of the chart. You can choose any hexadecimal color code as per your wish. We have used charting.fontColor to change the colors of the fonts and also used charting.foregroundColor to change the foreground color of the chart lines.

After adding the options in the source code click on Save to save the changes.

back4

As you can see, we have created a cool dashboard with a custom background color in the column chart. You can also change the background color of a bar chart, pie chart etc. in the same way.

back5

You can download the source code of this sample dashboard by clicking the below button.

Source Code

Hope this has helped you in achieving the below requirement without fail:

How to Change the Background Color of a Chart in Splunk

 

You can also know about :  How to Add Dropdown Input option to Splunk Dashboard

Happy Splunking !!

What’s your Reaction?
+1
2
+1
+1
4
+1
+1
2
+1
+1

Spread our blog
Previous articleCreating a Splunk Locale
Next articleUsage of Splunk commands  : PREDICT
Passionate content developer dedicated to producing result-oriented content, a specialist in technical and marketing niche writing!! Splunk Geek is a professional content writer with 6 years of experience and has been working for businesses of all types and sizes. It believes in offering insightful, educational, and valuable content and it's work reflects that.

1 COMMENT

LEAVE A REPLY

Please enter your comment!
Please enter your name here