dreamRs / apexcharter

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

Heatmap in shiny: specifying 'dataLabels' color lead to a blank grid #32

Closed u909090 closed 3 years ago

u909090 commented 3 years ago

When I specify a color (e.g. black - #000000), to dataLabels, no plot is produced.

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 = TRUE, style =list(colors = "#000000"))
  })
}

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

Hello,

You have to use a list for specifying colors because JavaScript expect an array, e.g.:

colors = list("#000000")

Victor