dreamRs / apexcharter

:bar_chart: R Htmlwidget for ApexCharts.js
https://dreamrs.github.io/apexcharter
Other
138 stars 15 forks source link

Heatmap in shiny: grid color is not responsive #33

Closed u909090 closed 2 years ago

u909090 commented 3 years ago

It seems not possible to change the colors of the x/y grid lines (i.e. between the cells).

Example:

library(shiny)
library(apexcharter)

data("vaccines", package = "highcharter")
df <- vaccines %>% subset(year <= 1946)

ui <- fluidPage(
  apexchartOutput("heatmap")
)

server <- function(input, output) {
  output$heatmap <- renderApexchart({
    apex(df,
         aes(year, state, fill = count),
         type = "heatmap") %>% 
      ax_chart(animations = list(enabled = FALSE)) %>%
      ax_dataLabels(enabled=F) %>%
      ax_grid(xaxis = list(lines = list(show = T)), yaxis = list(lines = list(show = T)), borderColor = "#FF0000")
  })

}

shinyApp(ui = ui, server = server)
u909090 commented 3 years ago

Found a work around by setting ax_grid(position = "front", ...)

pvictor commented 2 years ago

You can do:

apex(df,
     aes(year, state, fill = count),
     type = "heatmap") %>% 
  ax_chart(animations = list(enabled = FALSE)) %>%
  ax_dataLabels(enabled = FALSE) %>%
  ax_stroke(colors = list("#FE2E2E"))