First, you should load recharts:

library(recharts)

1 Introduction

roamController is only for maps. The default position of roamController is 2 o’clock. Since the map can move and scale by default, roamController is not quite useful.

The recommended approach to use setRoam is chart %>% setRoam(...).

2 Function Call

All the function names have two forms: small camel and lowercase_underscore (endorsed by Hadley Wickham). To be lazy, we also provide short forms as well (e.g., rc for roamController).

setRoam(chart, show = TRUE, pos = 2, width = 80, height = 120,
  bgColor = "rgba(0,0,0,0)", borderColor = "#ccc", borderWidth = 0,
  fillerColor = "#fff", handleColor = "#6495ed", step = 15,
  mapTypeControl = NULL, ...)

set_roam(chart, show = TRUE, pos = 2, width = 80, height = 120,
  bgColor = "rgba(0,0,0,0)", borderColor = "#ccc", borderWidth = 0,
  fillerColor = "#fff", handleColor = "#6495ed", step = 15,
  mapTypeControl = NULL, ...)

set_rc(chart, show = TRUE, pos = 2, width = 80, height = 120,
  bgColor = "rgba(0,0,0,0)", borderColor = "#ccc", borderWidth = 0,
  fillerColor = "#fff", handleColor = "#6495ed", step = 15,
  mapTypeControl = NULL, ...)
Arg Requirement

chart

Echarts object generated by echartR or echart.

show

logical. Show the roamController control if TRUE. If you want to remove roamController from the echarts object, set it NULL.

pos

Clock position of the roamController. Default 2. Refer to vecPos. Or you can define the position vector c(x, y, orient) yourself. But note that roamController is always vertical.

width

The width of the roamController. Default 80px.

height

The width of the roamController. Default 120px.

bgColor

background color, default transparent (‘rgba(0,0,0,0)’).

borderColor

Border color, default ‘#ccc’.

borderWidth

Border width, default 0px (not shown).

fillerColor

Filler color, default ‘#fff’.

handleColor

Handle color, default ‘#6495ed’.

step

Movement in px per move. Default 15px.

mapTypeControl

Which map to be controlled by roamController. E.g,, list(china=TRUE). Default NULL and setRoam will calculate automatically.

Elipsis.

3 Showcase

g <- echartr(NULL, type='map_china')
g

Initially roamController is not shown. Let’s turn if on.

g %>% setRoam(show=TRUE)

Relocate the roamController.

g %>% setRoam(pos=8)

Customize the format.

g %>% setRoam(bgColor='darkgray', fillerColor='white', handleColor='black')

set mapTypeControl and it no longer takes effect on China map.

g %>% setRoam(mapTypeControl=list(world=TRUE))