Make Highchart Map Tooltip Show Other Columns From Dataframe

36 views Asked by At

I am creating a flex dashboard in R which includes a map of counties in Michigan using highchart. The input dataframe looks like this:

County Column B Column C Column D
Alcona 15 8 26
Alger 10 11 13

I've created the map using Column B as the values. Currently the tooltip shows the name of the county, the numerical value in Column B, and a suffix of "%". What I want to do is continue making the map with the values from Column B, but make the tool tip show the values from Column C and Column D on different lines below as well. So I want the tooltip to look like this:

[County Name]

Column B: [value]%

Column C [value]%

Column D: [value]%

The code I used to create the map with the current tooltip is

hcmap( "countries/us/us-mi-all", data = df, value = "Column B", joinBy = c("name", "County"), name = "Michigan Counties", dataLabels = list(enabled = TRUE, format = "{point.name}"), borderColor = "#FAFAFA", borderWidth = 0.1, tooltip = list( valueSuffix = "%"))

I tried using the tooltip.formatter argument in Highcharts but I am new to the package so couldn't figure out how to make it work. Thank you in advance for your help!

0

There are 0 answers