Make pulse-icon set
Make Pulse Icon
An icon can be represented as a list of the form list(color, iconSize,
...)
. This function is vectorized over its arguments to create a list of
icon data. Shorter argument values will be re-cycled. NULL
values for
these arguments will be ignored.
Add Pulse Markers
pulseIconList(...)# S3 method for leaflet_pulse_icon_set
[(x, i)
makePulseIcon(color = "#ff0000", iconSize = 12, animate = TRUE,
heartbeat = 1)
pulseIcons(color = "#ff0000", iconSize = 12, animate = TRUE,
heartbeat = 1)
addPulseMarkers(map, lng = NULL, lat = NULL, layerId = NULL,
group = NULL, icon = NULL, popup = NULL, popupOptions = NULL,
label = NULL, labelOptions = NULL, options = leaflet::markerOptions(),
clusterOptions = NULL, clusterId = NULL,
data = leaflet::getMapData(map))
icons created from makePulseIcon()
icons
offset
Color of the icon
Size of Icon in Pixels.
To animate the icon or not, defaults to TRUE.
Interval between each pulse in seconds.
the map to add pulse Markers to.
a numeric vector of longitudes, or a one-sided formula of the form
~x
where x
is a variable in data
; by default (if not
explicitly provided), it will be automatically inferred from data
by
looking for a column named lng
, long
, or longitude
(case-insensitively)
a vector of latitudes or a formula (similar to the lng
argument; the names lat
and latitude
are used when guessing
the latitude column from data
)
the layer id
the name of the group the newly created layers should belong to
(for clearGroup
and addLayersControl
purposes).
Human-friendly group names are permitted--they need not be short,
identifier-style names. Any number of layers and even different types of
layers (e.g. markers and polygons) can share the same group name.
the icon(s) for markers;
a character vector of the HTML content for the popups (you are
recommended to escape the text using htmlEscape()
for security reasons)
options for popup
a character vector of the HTML content for the labels
A Vector of labelOptions
to provide label
options for each label. Default NULL
a list of extra options for tile layers, popups, paths (circles, rectangles, polygons, ...), or other map elements
if not NULL
, markers will be clustered using
Leaflet.markercluster;
you can use markerClusterOptions()
to specify marker cluster
options
the id for the marker cluster layer
the data object from which the argument values are derived; by
default, it is the data
object provided to leaflet()
initially, but can be overridden
# NOT RUN {
iconSet = pulseIconList(
red = makePulseIcon(color='#ff0000'),
blue = makePulseIcon(color='#0000ff')
)
iconSet[c('red', 'blue')]
# }
Run the code above in your browser using DataLab