jbkunst / highcharter

R wrapper for highcharts
http://jkunst.com/highcharter/
Other
720 stars 148 forks source link

Tooltip nullFormat not working in maps #789

Open rwaaijman opened 1 year ago

rwaaijman commented 1 year ago

when creating a map with missing data, I would like to show a tooltip "Missing" It took a long time before I found the solution: series(nullInteraction = TRUE). Is it possible to set this standard on TRUE?



mapdata <- get_data_from_map(download_map_data("custom/usa-and-canada"))

glimpse(mapdata)

data_fake <- mapdata |>
  select(code = `hc-a2`) |>
  mutate(value = 1e5 * abs(rt(nrow(mapdata), df = 10)))

# value NT on not available
data_fake$value[data_fake$code == "AZ"] <- NA

glimpse(data_fake)

highchart(type = "map") |>
  hc_chart(map = download_map_data("custom/usa-and-canada")) |>
  hc_add_series(
    data_fake
    , joinBy = c("hc-a2", "code")
    , name = "Fake data"
    , dataLabels = list(enabled = TRUE, format = "{point.name}", nullFormat = "N/A")
    #, nullInteraction = TRUE
  ) |>
  hc_colorAxis(auxpar = NULL) |>
  hc_tooltip(valueDecimals = 0, nullFormat = "Missing data")```
stale[bot] commented 6 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Feel free to reopen it if you find it necessary.