Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Heatmap: how to specify the cell base color instead of white? #34

Open
u909090 opened this issue Oct 30, 2020 · 1 comment
Open

Heatmap: how to specify the cell base color instead of white? #34

u909090 opened this issue Oct 30, 2020 · 1 comment

Comments

@u909090
Copy link

u909090 commented Oct 30, 2020

Is there a way to change the color of the cells reaching the minimum value (white by default) when using a color gradient?

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_colors("#0000FF") %>%
      ax_plotOptions(heatmap = heatmap_opts(colorScale = list(min = min(df$count), max = max(df$count))))
  })  
}

shinyApp(ui = ui, server = server)

Submitting a minimum value below the actual dataset minimum value does not do the trick neither:

ax_plotOptions(heatmap = heatmap_opts(colorScale = list(min = min(df$count) - 1000, max = max(df$count))))
@u909090
Copy link
Author

u909090 commented Oct 30, 2020

Found a work around, but the tooltip do not display anymore:

ax_grid(position="front", row = list(colors = "f8f8f8", opacity = 0.1))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant