Spread our blog

How to Add Custom Colors in the Charts in Splunk

Hello guys !! In Splunk Dashboard we usually do many column charts , bar charts for better visualizing of our IT data. All of you know that when we create any column chart or bar chart , Splunk by default gives you few colors for showing those data.  The colors are not as attractive as you want. So here we are to show you how to add custom colors in the charts in Splunk.

At first make the dashboard with column charts or bar charts as you want. Below we have created a sample dashboard called Chart Dashboard.

In the first panel we have created a Column Chart and in the second panel we have created a Bar Chart with stacked mode.

The query behind the panels is index=_internal | stats count by method,status,date_hour | head 10

color1

As you can see that colors are not so attractive.

Below we have shown how to customize the colors in charts. For that you have to edit the source code of your dashboard. You can see the Edit option on the top right corner of you dashboard. Click on Edit.

color2

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

color3

Now in the source code you have to add an option inside the chart tag.

For the Column Chart panel we have written the option as :

<option name="charting.fieldColors">
{"status":#66FF00,"date_hour":#FF0000,"count":#00009C}</option>

Here status , date_hour and count are the fields names of the column chart. Also you have to specify the hexadecimal codes of the colors for every fields which you want color  . You can put any hexadecimal color codes as per your wish.

For the Bar Chart panel we have written the option as :

<option name="charting.fieldColors">
{"status":#00FF00,"date_hour":#FFF700,"count":#00009C}</option>

Here status , date_hour and count are the fields names of the bar chart. Also you have to specify the hexadecimal codes of the colors for every fields which you want color  . You can put any hexadecimal color codes as per your wish.

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

color 4

color5

Finally we have got a attractive dashboard in Splunk. Like this way you can make your dashboards more attractive and more glossy.

color6

You can also 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 Add Custom Colors in the Charts in Splunk

 

You can also know about :  Splunk Drilldown Tokens: $click.value$ (Part-II)

Happy Splunking !!

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

Spread our blog
Previous articleHow to Create a Search Macro in Splunk
Next articleCreating a Splunk Locale
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.

6 COMMENTS

LEAVE A REPLY

Please enter your comment!
Please enter your name here