score:1

Accepted answer

you can add categories to your hc_xaxis to make an order like this:

library(highcharter) 

dta |> 
  hchart(type = "column", hcaes(x = "event", y = "n", group = "sociodemographic_var")) |> 
  hc_yaxis(title = list(text = "%"), max = 115, endontick = false, stacklabels = list(enabled = true)) |> 
  hc_xaxis(title = "", categories = levels(dta$event)) |> 
  hc_plotoptions(series = list(stacking = "percent"))

output:

enter image description here


Related Query

More Query from same tag