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
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.
Now you can see the Source option on the top left corner of the page. Click on Source to edit the source code.
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.
Finally we have got a attractive dashboard in Splunk. Like this way you can make your dashboards more attractive and more glossy.
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
Happy Splunking !!
[…] 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 […]
Is their any way out to put threshold over their
Yes we can put the threshold also
I want to change cover on the basis of threshold. How to do that?
What do you mean by cover?
How to color the bar chart of a field based on other field value?