
Add a timeline control to the map or control panel
Source:R/animation_controls.R
add_timeline_control.RdThe timeline control allows for users to interact with a date-based timeline, and can be used to control an animation of map data over time.
Arguments
- map
The map or map proxy object.
- start_date
Start date for the timeline (YYYY-MM-DD format).
- end_date
End date for the timeline (YYYY-MM-DD format).
- position
Position on the map if not using a control panel. Default is "bottom-left".
- max_ticks
Maximum number of labeled ticks to prevent overlap. Default is 3.
- panel_id
ID of control panel to add to (optional).
- section_title
Section title when added to a control panel.
- group_id
Optional ID of the group to add the control to within a panel.
Optional named list of custom icons for the play/pause button. Accepts names
"play"and"pause". Each value can be an inline SVG string, a local PNG or SVG file path (automatically converted to a data URI), or plain text.NULLentries fall back to the default icon.Optional named list of text labels shown alongside icons. Accepts names
"play"and"pause". Pass an empty list to show icons only.
Examples
# Add to a map (no dates specified)
map() |>
add_timeline_control()
# Add to map with dates
map() |>
add_timeline_control(
start_date = Sys.Date(),
end_date = Sys.Date() + 30
)
# Add to a control panel
map() |>
add_control_panel(panel_id = "my_panel", title = "Map Settings") |>
add_timeline_control(
start_date = Sys.Date(),
end_date = Sys.Date() + 30,
panel_id = "my_panel"
)
# Add to a control panel inside a control group
map() |>
add_control_panel(panel_id = "my_panel", title = "Map Settings") |>
add_control_group(
panel_id = "my_panel",
group_id = "animation_controls",
group_title = "Animation Controls"
) |>
add_timeline_control(
start_date = Sys.Date(),
end_date = Sys.Date() + 30,
panel_id = "my_panel",
group_id = "animation_controls"
)