highcharts 删除highcharterMap工具提示中的“系列1”文本

tvokkenx  于 12个月前  发布在  Highcharts
关注(0)|答案(1)|浏览(216)

在我的交互式highcharterMap中,我想删除工具提示中的“Series 1”文本,并将该部分改为空白。我还想删除国家名称后面的冒号和1。如何才能做到这一点?我仍然希望在工具提示中保留国家名称。(https://i.stack.imgur.com/2KLKG.png
下面是我的代码:

library(highcharter)
library(maps)

countrylabeldata<-iso3166

countrylabeldata <- rename(countrylabeldata, "iso-a3" = a3)

Swahili_countries <- c("BDI","COD", "KEN", "OMN", "RWA", "TZA", "UGA")

countrylabeldata$include <- ifelse(countrylabeldata$`iso-a3` %in% Swahili_countries, 1, 0)

hcmap(
  map = "custom/world-highres3", 
  data = countrylabeldata, 
  joinBy = "iso-a3",
  value = "include",
  showInLegend = FALSE,
  nullColor = "#DADADA",
  download_map_data = TRUE,
) %>%
  hc_mapNavigation(enabled = T) %>%
  hc_legend("none") %>%
  hc_title(text = "Countries with Highest Prevalence of Swahili Speakers")%>%
  hc_caption(text="Data from CIA World Factbook")

字符串

hsvhsicv

hsvhsicv1#

要删除“Series 1”,请将变量“name”设置为空格,即name = ""。至于:0和:1,您可以通过删除hcmap中的变量value = "include"来删除,但它会删除您突出显示的特定国家。是否要保留Map上突出显示的国家?有人可能有比我更有效的答案。
以下是我如何编辑你的代码:

hcmap(
 map = "custom/world-highres3", 
 data = countrylabeldata, 
 joinBy = "iso-a3",
 showInLegend = FALSE,
 value = "include",
 nullColor = "#DADADA",
 name = "",
 download_map_data = TRUE) %>%
hc_mapNavigation(enabled = T) %>%
hc_legend("none") %>%
hc_title(text = "Countries with Highest Prevalence of Swahili Speakers")%>%
hc_caption(text= "Data from CIA World Factbook")

字符串

相关问题