Open learning-freak opened 1 year ago
You're close but you need to use double quotes and escape them for the style attribute. Also I think 'color' is more appropriate when stylizing text.
highchart() %>%
hc_add_series(
data = df$len,
type = 'line'
) %>%
hc_xAxis(categories = df$dose,
labels = list(
# useHTML = T,
formatter = JS(
"function() {
if (this.value =='D1' ) {
console.log(this.value)
return '<span style=\"color: red;\">' + this.value + '</span>';
}
return this.value;
}"
)
))
Hi, This my dataset
I want to change the color of just one label (the label "D1") in red (not all the labels). I saw this documentation : https://api.highcharts.com/highcharts/xAxis.labels.formatter and I tried to do the same thing but nothing has changed
How do I apply style to individual labels to get only the label "D1" in red ? This is what I did :
Some help would be appreciated