Creates a list of data items suitable for passing to
echarts4r::e_map(data = ...) to style the frames around the island
insets, with line widths based on geopt_frame_level. Because the data
parameter in echarts replaces the entire series data, this function returns
entries for all features — preserving the mapped values for real
regions and styling frames as transparent overlays.
Usage
frame_data_echarts(
sf_obj,
value_col,
level_widths = c(0.8, 0.4, 0.2),
border_color = "#333"
)Arguments
- sf_obj
An sf object returned by
get_map().- value_col
Name of the value column being mapped (as a string).
- level_widths
Numeric vector mapping frame level to border width. Position 1 corresponds to
geopt_frame_level == 1, etc.- border_color
Border color string. Default
"#333".
Value
A list of named lists, each with name, value, and (for frames)
itemStyle. Pass this to echarts4r::e_map(data = ...).
Examples
m <- get_map("municipio")
m$name <- dplyr::coalesce(m$municipio, m$geopt_label)
geojson <- geojsonsf::sf_geojson(m)
m |>
echarts4r::e_charts(name) |>
echarts4r::e_map_register("pt", geojson) |>
echarts4r::e_map(area_ha, map = "pt", roam = TRUE,
data = frame_data_echarts(m, "area_ha")) |>
echarts4r::e_visual_map(area_ha)
