output$tab_1_route <- renderHighchart({
req(patients_filter())
req(patients_filter() %>% nrow() > 1)
dta <- patients_filter() %>%
group_by(ipdopd, route) %>%
count() %>%
complete(ipdopd, route, fill = list(n = 0)) %>%
ungroup() %>%
mutate(total_presciptions = sum(n)) %>%
mutate(pct = round(100*n / total_presciptions, 1))
hchart(dta, type = "column", hcaes(x = route, y = pct, group = ipdopd)) %>%
hc_yAxis(title = "Number of Specimens") %>% hc_xAxis(title = "Quarter") %>%
hc_colors(as.vector(colors_ipd_opd)[c("Inpatient" %in% dta$ipdopd, "Outpatient" %in% dta$ipdopd)]) %>%
hc_tooltip(headerFormat = "", pointFormat = "{point.pct}% <br>({point.n} of {point.total_presciptions} prescriptions)") %>%
hc_yAxis(title = list(text = "% of Prescriptions"))
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.