score:1
Accepted answer
bit of a pain to get this to work but i believe this is a solution to your question. unfortenly there doesn't appear to be a way to do this with highcharts
directly so you have to manipulate the data beforehand.
library(highcharter)
library(tidyverse)
cols <- c("#2c3e50", "#f39c12")
dta %>%
ungroup() %>%
mutate(antibiotic = factor(antibiotic) %>% fct_reorder(n, .desc = true)) %>%
mutate(cat_index = as.numeric(antibiotic)) %>%
hchart(
type = "bar",
hcaes(x = cat_index,
y = n,
group = category,
name = antibiotic),
color = cols
) %>%
hc_xaxis(type = "category", labels = list(step = 1)) %>%
hc_yaxis(title = "", stacklabels = list(enabled = true)) %>%
hc_tooltip(headerformat = "",
pointformat = "{point.n} patients have taken {point.antibiotic}") %>%
hc_plotoptions(series = list(stacking = "normal"))
Source: stackoverflow.com
Related Query
- Custom colors in R highcharter barplot
- Custom colors in Highcharter are not mapping correctly to the legend
- Highcharts - How to set custom colors for the series
- r highcharter package barplot group vs. color
- How to change the palette colors of a highcharter column plot which depends on a variable?
- HighCharts: How to combine custom colors with gradient
- Highcharter R custom button for log axis
- Customize colors for boxplot with highcharter
- Highcharter bar colors issue
- Highcharts 3D pie with custom colors
- Highchart highlight area between points with custom colors
- How to change colors of a highcharter matrix/heatmap?
- Applying a custom colors on HighCharts Line?
- Strange character in the Highstock source code
- How to Create Custom Shapes in R Highcharter
- Setting custom colors in Highcharts drill-down maps
- Highcharts - apply gradient on custom colors
- highcharts custom colors and tootip point color
- Highcharts heatmap with custom colors for each yAxis
- Color coutries/continents with own custom colors in highmaps
- highcharter custom animation
- HeatMap with custom colors for each cell
- HighCharts : Is it possible to customize the colors of individual series?
- set different colors for each column in highcharts
- How can I change the colors of my highcharts piechart?
- Styling bar colors in Highcharts with a gradient issue
- highcharts: dynamically define colors in pie chart
- Highcharts Area graph, use 2 fill colors above / below X axis
- highcharts datetime x-axis custom formatting
- R Highcharter Sankey nodes column property trouble
More Query from same tag
- Highmaps mulitple series can't seen without disable one
- Override Highcharts waterfall isSum() value
- Conflict between Highcharts and JQuery 1.8.2
- Scale graph in angular
- Highcharts - different fill colors between x coordinates over hover
- SVG javascript chart scraping
- How to Disable Highchart Unit Display None
- Highcharts doesn't work on Heroku
- setting size of chart in dotnet highchart?
- Plot a a json chart with HighCharts & Vue.js
- HighCharts : Polar chart not stretched in its frame
- Pass custom date object from jalali-moment library to time.Date option
- How to clear blank below heatmap
- Chart area exceeding series length
- How to Apply Rotation to Drilldown Lable in Highcharts
- How to put data in Highchart from session storage?
- Error in R with highcharter library
- Show dividing lines between horizontal bars on highcharts graph
- Extjs with HighCharts
- Highcharts type flags with custom legend icon
- ChartJS/High Charts Radar chart - Different radial axis labels for each category that appear on hover
- Highcharts negative logarithmic scale solution stopped working
- Highchart columnrange, color code lines based on data
- Highcharts: locating column group information on mouseover
- Highchart - colors depending on values
- how to change the title in highcharts
- Highcharts - How can I put a 100% fix value in the X axis?
- Highcharts - Legend Positioning outside the chart
- Highstock: Change color of date input box border if active
- Simultaneous actions on action event on one graph