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
- R highcharter plot points color based on value
- How do you increase the performance of highcharts chart creation and rendering
- highchart change color of single bar in single category
- High charts labels display values not names
- Highcharts live chart: JSON showing Strings -- not working
- High Charts Breaking jQuery Across Rails App
- Print charts in new tab
- Highstock tooltip Formatter not able to display extra data
- How to resize card content to its size in material ui?
- Highcharts Resetting Drilldown (three layers) to Initial state
- Scatter chart plot on border if values are outside the bounderies
- HighChart : Usage of setData
- The labels are displayed but data is not displayed
- Overlap datalabels line chart highcharts
- how to show legend in PIE chart from chart to pie drilldown highcharts
- Time-Date and Event chart or Graph in Highchart
- Highcharts: locating column group information on mouseover
- Click event in drilldown chart - Highcharts
- how to get the axis value when I click on a cursor in highstock(high charts)?
- How can I add different icons in the legend
- how to Extend highchart plot band outside graph using android wrapper
- High charts tooltip location issues
- Creating dynamic Highcharts based on an array
- How to update the series data of piechart(using highchart) through loop in angular
- Highcharts - Sankey chart not displaying all the data when series font increased
- How do I make a same range
- How to auto adjust the bar with respect to the plotBand option in xrange highcharts?
- Reverse Axis in Highcharts get data from table
- Looping data inside highchart.js using type column chart
- Hide/show all series in Highcharts?