Provided below is my code 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}") %>%
})
https://i.sstatic.net/ThjSr.png
Also, included is my dataset information,
https://i.sstatic.net/oytjc.png
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")
While everything seems to be in working order, there seems to be an issue with the legend display as it shows a gradient regardless of the assigned color column. How can I specify the legend to correspond with the color column and associated changelabels like:
<20% Decrease - color (#B7DEE8)
>20% Decrease - color (#00B0F0)