emap: Add blank map

Description Usage Arguments See Also Examples

View source: R/add.R

Description

Setup map plot.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
emap(p, name = NULL, mapType = "world", clickable = TRUE, z = 2,
  zlevel = 0, selectedMode = NULL, hoverable = FALSE,
  dataRangeHoverLink = TRUE, mapLocation = list(x = "center", y = "center"),
  mapValueCalculation = "sum", mapValuePrecision = 0,
  showLegendSymbol = TRUE, roam = FALSE, scaleLimit = NULL,
  nameMap = NULL, textFixed = NULL, ...)

emap_(p, name = NULL, mapType = "world", clickable = TRUE, z = 2,
  zlevel = 0, selectedMode = NULL, hoverable = FALSE,
  dataRangeHoverLink = TRUE, mapLocation = list(x = "center", y = "center"),
  mapValueCalculation = "sum", mapValuePrecision = 0,
  showLegendSymbol = TRUE, roam = FALSE, scaleLimit = NULL,
  nameMap = NULL, textFixed = NULL, ...)

Arguments

p

an echart object.

name

name of serie.

mapType

type of map, see examples.

clickable

whether elements are clickable.

z, zlevel

first and second grade cascading control, the higher z the closer to the top.

selectedMode

whether items can be selected.

hoverable

whether elements are hoverable.

dataRangeHoverLink

enables dataRange hover link to the chart.

mapLocation

x and y location of map on canvas, takes top, bottom, left, right, center.

mapValueCalculation

takes sum or average.

mapValuePrecision

decimal precision.

showLegendSymbol

whether to show symbol on legend.

roam

enables zoom and drag.

scaleLimit

controls drag and zoom limits.

nameMap

custom name mapping.

textFixed

fixed text location for a region.

...

any other options to pass to map serie.

See Also

emap_coords, emap_heat, emap_lines, emap_choropleth, emap_points, official map docs

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
## Not run: 
coords <- data.frame(city = c("London", "New York", "Beijing", "Sydney"),
  lon = c(-0.1167218, -73.98002, 116.3883, 151.18518),
  lat = c(51.49999, 40.74998, 39.92889, -33.92001),
  values = runif(4, 10, 20))

coords %>%
  echart_("city") %>% # initialise chart
  emap_() %>% # setup default map
  emap_coords_("lon", "lat") %>% # add coordinates
  emap_points_("values") # plot values on coordinates

edges <- data.frame(source = c("Beijing", "Beijing", "New York"),
  target = c("Sydney", "London", "London"))

coords %>%
  echart_("city") %>%
  emap_() %>%
  emap_coords_("lon", "lat") %>%
  emap_lines_(edges, "source", "target")

data <- data.frame(lon = runif(200, 90, 120),
  lat = runif(200, 30, 39),
  z = runif(200, 50, 75))

data %>%
  echart_() %>%
  emap_(mapType = "china") %>%
  emap_heat_("lon", "lat", "z")

us_data <- data.frame(state = c("New York", "Los Angeles", "Dallas"),
                      lat = c(40.730610, 34.052235, 33.940369),
                      lon = c(-73.935242, -118.243683, -84.692894),
                      values = round(runif(3, 1, 2)))

us_data %>%
  echart_("state") %>%
  emap(mapType = "world|United States of America") %>%
  emap_coords_("lon", "lat") %>%
  emap_points_("values")

## End(Not run)

JohnCoene/echarts documentation built on May 22, 2021, 6:18 p.m.