Splunk Search

How to change color of value text in chart?

feickertmd
Communicator

I have a bar chart created in the which I am showing data values above the bars. However, the tallest bar has the text inside of it, and the colors blend too much. In simple XML, can I change the color of the text to darken it?

Labels (1)
0 Karma
1 Solution

niketn
Legend

EDITED

Since you want to make changes to column data labels which are highchart-data-labels elements not exposed by charting properties like charting.fontColor you can try one of the following options:

1) Option 1 - charting.backgroundColor
Without CSS make column chart Data Labels prominent by changing chart color to contrast
cyan
Pros - No need to modify through css.
Cons - Panel might look ugly. (White or Black background colors usually suits dashboards)

2) Option 2 - Through CSS

(i) Override the highcharts-data-label text color to the color of your choice using following css custom_highcharts.css.

/* SVG Highcharts Data Labels color overridden to blue*/
g.highcharts-data-labels text {
    fill: blue !important;
}

(ii) Place the CSS under your Splunk App folder -

$SPLUNK_HOME\etc\apps\<yourAppName>\appserver\static

PS:
- If you have not put any static files for your Splunk App you would need to create appserver\static folder yourself
- If you do not have access to manually place the CSS file to specific Splunk folder, you can load the same through Manage App Edit Properties using Upload asset feature.

(iii) Include the CSS file in your dashboard/form

<form stylesheet="custom_highcharts.css">

(iv) Restart Splunk (splunkd) and clear browser cache for the changes to take place.

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"

View solution in original post

0 Karma

gokadroid
Motivator

Can you please try this option and see if it works out for your version of Splunk:

<!-- Set font color (axis labels, legends) -->
        <option name="charting.fontColor">#FFDDCC</option>

Use the hex code of your choice in it.

supraja
Path Finder

Hi Team,

 

could some one please suggest  on changing the data label color in bar chart . changing the font color of  data label 192. 

 

supraja_0-1667552581130.png

 

0 Karma

feickertmd
Communicator

Actually did this well before your comment. Changed axis labels and legend labels, but not values

0 Karma

becksyboy
Communicator

Thanks this worked for me

0 Karma

feickertmd
Communicator

alt text

This is the text I want to change. The options you mention only change the colors of the bars.

0 Karma

feickertmd
Communicator

Actually did this well before your comment. Changed axis labels and legend labels, but not values

0 Karma

puneethgowda
Communicator

no luck for this!

0 Karma

puneethgowda
Communicator

i want to change the value of the data label can any one helm me on this

0 Karma

niketn
Legend

EDITED

Since you want to make changes to column data labels which are highchart-data-labels elements not exposed by charting properties like charting.fontColor you can try one of the following options:

1) Option 1 - charting.backgroundColor
Without CSS make column chart Data Labels prominent by changing chart color to contrast
cyan
Pros - No need to modify through css.
Cons - Panel might look ugly. (White or Black background colors usually suits dashboards)

2) Option 2 - Through CSS

(i) Override the highcharts-data-label text color to the color of your choice using following css custom_highcharts.css.

/* SVG Highcharts Data Labels color overridden to blue*/
g.highcharts-data-labels text {
    fill: blue !important;
}

(ii) Place the CSS under your Splunk App folder -

$SPLUNK_HOME\etc\apps\&lt;yourAppName&gt;\appserver\static

PS:
- If you have not put any static files for your Splunk App you would need to create appserver\static folder yourself
- If you do not have access to manually place the CSS file to specific Splunk folder, you can load the same through Manage App Edit Properties using Upload asset feature.

(iii) Include the CSS file in your dashboard/form

<form stylesheet="custom_highcharts.css">

(iv) Restart Splunk (splunkd) and clear browser cache for the changes to take place.

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

feickertmd
Communicator

If CSS is my only viable option, so be it!

0 Karma

feickertmd
Communicator

I am certain that CSS will work, but was looking for other solutions due to admin limitations. Thanks!

0 Karma

niketn
Legend

@feickertmd Can you please check and confirm whether the following solution worked for you or not?

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma
Get Updates on the Splunk Community!

Introducing Edge Processor: Next Gen Data Transformation

We get it - not only can it take a lot of time, money and resources to get data into Splunk, but it also takes ...

Take the 2021 Splunk Career Survey for $50 in Amazon Cash

Help us learn about how Splunk has impacted your career by taking the 2021 Splunk Career Survey. Last year’s ...

Using Machine Learning for Hunting Security Threats

WATCH NOW Seeing the exponential hike in global cyber threat spectrum, organizations are now striving more for ...