# NOT RUN {
set.seed(666)
x <- 1:20
dat <- data.frame(
x = x,
y1 = rnorm(20, sd = 1.5),
y2 = rnorm(20, 10, sd = 1.5),
z1 = rnorm(20, x+5, sd = 1.5),
z2 = rnorm(20, x+15, sd = 1.5)
)
amRangeAreaChart(
data = dat,
width = "700px",
xValue = "x",
yValues = rbind(c("y1", "y2"), c("z1", "z2")),
xLimits = c(1, 20),
draggable = TRUE,
backgroundColor = "#30303d",
tooltip = list(
y1 = amTooltip(
text = "[bold]upper: {openValueY}\nlower: {valueY}[/]",
textColor = "yellow",
backgroundColor = "darkmagenta",
backgroundOpacity = 0.8,
borderColor = "rebeccapurple",
scale = 0.9
),
y2 = amTooltip(
text = "[bold]upper: {valueY}\nlower: {openValueY}[/]",
textColor = "yellow",
backgroundColor = "darkmagenta",
backgroundOpacity = 0.8,
borderColor = "rebeccapurple",
scale = 0.9
),
z1 = amTooltip(
text = "[bold]upper: {openValueY}\nlower: {valueY}[/]",
textColor = "white",
backgroundColor = "darkred",
backgroundOpacity = 0.8,
borderColor = "crimson",
scale = 0.9
),
z2 = amTooltip(
text = "[bold]upper: {valueY}\nlower: {openValueY}[/]",
textColor = "white",
backgroundColor = "darkred",
backgroundOpacity = 0.8,
borderColor = "crimson",
scale = 0.9
)
),
bullets = list(
y1 = amCircle(color = "yellow", strokeColor = "olive"),
y2 = amCircle(color = "yellow", strokeColor = "olive"),
z1 = amCircle(color = "orangered", strokeColor = "darkred"),
z2 = amCircle(color = "orangered", strokeColor = "darkred")
),
alwaysShowBullets = FALSE,
lineStyle = list(
y1 = amLine(color = "yellow", width = 3, tensionX = 0.8, tensionY = 0.8),
y2 = amLine(color = "yellow", width = 3, tensionX = 0.8, tensionY = 0.8),
z1 = amLine(color = "orangered", width = 3, tensionX = 0.8, tensionY = 0.8),
z2 = amLine(color = "orangered", width = 3, tensionX = 0.8, tensionY = 0.8)
),
areas = list(
list(name = "y1-y2", color = "blue", opacity = 0.2),
list(name = "z1-z2", color = "red", opacity = 0.2)
),
cursor = list(
tooltip = amTooltip(
backgroundColor = "silver"
),
extraTooltipPrecision = list(x = 0, y = 2),
modifier = list(y = "text = parseFloat(text).toFixed(2);")
),
chartTitle = amText(text = "Range area chart",
color = "whitesmoke",
fontWeight = "bold"),
xAxis = list(title = amText(text = "Observation",
fontSize = 20,
color = "silver"),
labels = amAxisLabels(color = "whitesmoke",
fontSize = 17),
adjust = 5),
yAxis = list(title = amText(text = "Value",
fontSize = 20,
color = "silver"),
labels = amAxisLabels(color = "whitesmoke",
fontSize = 17),
gridLines = amLine(color = "antiquewhite",
opacity = 0.4, width = 1)),
Xformatter = "#",
Yformatter = "#.00",
image = list(
image = amImage(
href = tinyIcon("react", backgroundColor = "transparent"),
width = 40, height = 40
),
position = "bottomleft", hjust = 2, vjust = -2
),
theme = "dark")
# }
Run the code above in your browser using DataLab