Here is my snippet,
output$map <- renderHighchart({
region_map = hcmap("countries/nz/nz-all")
highchart(type = "map") %>%
hc_title(text = "Average") %>%
hc_add_series_map(map = region_map, df = data1, joinBy = "name", value = "LTA", borderColor = "#141B4D",
color = "color",
showInLegend = TRUE,
borderWidth = 1)
) %>%
hc_tooltip(useHTML = TRUE, headerFormat ="", pointFormat = "{point.name} <br> LTA: {point.value}") %>%
})
And my data here,
structure(list(name = c("Auckland", "Bay of Plenty", "Canterbury",
"Central North Island", "Central Otago / Lakes District", "Coromandel"
), LTA = c(23, 42, 25, 69, 71, 145), Changelabel = c("<20% Decrease",
">20% Decrease", "<20% Decrease", ">20% Decrease", ">20% Decrease",
">20% Decrease"), color = c("#B7DEE8", "#00B0F0", "#B7DEE8",
"#00B0F0", "#00B0F0", "#00B0F0")), .Names = c("name", "LTA",
"Changelabel", "color"), row.names = c(NA, 6L), class = "data.frame")
Everything is fine here, but when i enable the legend here, it is giving me the gradient irrespective of the color column I am using, how do i specify the color column with changelabel as legend like
<20% Decrease - color (#B7DEE8)
>20% Decrease - color (#00B0F0)
output$map
can be justmap
, right? Finally, theregion_map
name is also not found. I have to say: these maps questions are quite interesting!