First, you should load recharts
:
library(recharts)
The default position of dataZoom is 6 o’clock.
The recommended approach to use setDataZoom
is chart %>% setDataZoom(...)
.
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., dz for dataZoom).
setDataZoom(chart, show = TRUE, pos = 6, range = NULL, width = 30,
fill = "rgba(144,197,237,0.2)", handle = "rgba(70,130,180,0.8)",
bgColor = "rgba(0,0,0,0)", dataBgColor = "#eee", showDetail = TRUE,
realtime = FALSE, zoomLock = FALSE, ...)
set_datazoom(chart, show = TRUE, pos = 6, range = NULL, width = 30,
fill = "rgba(144,197,237,0.2)", handle = "rgba(70,130,180,0.8)",
bgColor = "rgba(0,0,0,0)", dataBgColor = "#eee", showDetail = TRUE,
realtime = FALSE, zoomLock = FALSE, ...)
set_dz(chart, show = TRUE, pos = 6, range = NULL, width = 30,
fill = "rgba(144,197,237,0.2)", handle = "rgba(70,130,180,0.8)",
bgColor = "rgba(0,0,0,0)", dataBgColor = "#eee", showDetail = TRUE,
realtime = FALSE, zoomLock = FALSE, ...)
setDZ(chart, show = TRUE, pos = 6, range = NULL, width = 30,
fill = "rgba(144,197,237,0.2)", handle = "rgba(70,130,180,0.8)",
bgColor = "rgba(0,0,0,0)", dataBgColor = "#eee", showDetail = TRUE,
realtime = FALSE, zoomLock = FALSE, ...)
Arg | Requirement |
---|---|
chart |
Echarts object generated by |
show |
logical. Show the dataZoom control if TRUE. If you want to remove dataZoom from the echarts object, set it NULL. |
pos |
Clock position of the dataZoom. Default 6. Refer to |
range |
A vector of |
width |
The width of the dataZoom bar. Default 20px. |
fill |
fillerColor of the dataZoom bar, in character ‘rgba(red, green, blue, alpha)’ format. Default |
handle |
handleColor of the dataZoom bar, in character ‘rgba(red, green, blue, alpha)’ format. Default |
bgColor |
background color, default transparent (‘rgba(0,0,0,0)’). |
dataBgColor |
background color of the data thumbnail (1st series). Default ‘#eee’. |
showDetail |
Logical, if show the details when zooming. Defaul TRUE. |
realtime |
Logical, if realtime display the changes when zooming. Default FALSE. |
zoomLock |
Logical, if the zoom range is locked. Deafult FALSE. |
… |
Elipsis. |
g <- echartr(iris, Sepal.Width, Petal.Width, Species)
g
Initially dataZoom is not shown. Let’s turn if on.
g %>% setDataZoom(show=TRUE)
Relocate the dataZoom
g %>% setDataZoom(pos=12)
Customize the format.
g %>% setDataZoom(bgColor='yellow', dataBgColor='gold', fill='tan',
handle='maroon')
Set the initial range 20% - 60%.
g %>% setDataZoom(range=c(20, 60))