Thrid y axis
kulmak opened this issue · comments
kulmak commented
Hello, I was wondering whether it's also possible to have a third y axis in my plot (exactly the same way as x_yaxis2 works). The goal would be to achieve something like this: https://apexcharts.com/javascript-chart-demos/mixed-charts/multiple-yaxis/
Thanks!
Victor Perrier commented
Currently that's not possible when using apex() %>% ax_yaxis() %>% ax_yaxis2()
, max 2 y-axis are supported. But nonetheless you can still use the full-api and do :
library(apexcharter)
apexchart(list(
series = list(
list(
name = "Income",
type = "column",
data = list(1.4, 2L, 2.5, 1.5, 2.5, 2.8, 3.8, 4.6)
),
list(
name = "Cashflow",
type = "column",
data = list(1.1, 3L, 3.1, 4L, 4.1, 4.9,
6.5, 8.5)
),
list(
name = "Revenue",
type = "line",
data = list(20L, 29L, 37L, 36L, 44L, 45L, 50L, 58L)
)
),
chart = list(
height = 350L,
type = "line",
stacked = FALSE
),
dataLabels = list(enabled = FALSE),
stroke = list(width = list(1L, 1L, 4L)),
title = list(
text = "XYZ - Stock Analysis (2009 - 2016)",
align = "left",
offsetX = 110L
),
xaxis = list(
categories = list(2009L, 2010L, 2011L, 2012L, 2013L, 2014L, 2015L, 2016L)
),
yaxis = list(
list(
axisTicks = list(show = TRUE),
axisBorder = list(show = TRUE, color = "#008FFB"),
labels = list(style = list(colors = "#008FFB")),
title = list(text = "Income (thousand crores)",
style = list(color = "#008FFB")),
tooltip = list(enabled = TRUE)
),
list(
seriesName = "Income",
opposite = TRUE,
axisTicks = list(show = TRUE),
axisBorder = list(show = TRUE, color = "#00E396"),
labels = list(style = list(colors = "#00E396")),
title = list(text = "Operating Cashflow (thousand crores)",
style = list(color = "#00E396"))
),
list(
seriesName = "Revenue",
opposite = TRUE,
axisTicks = list(show = TRUE),
axisBorder = list(show = TRUE, color = "#FEB019"),
labels = list(style = list(colors = "#FEB019")),
title = list(text = "Revenue (thousand crores)", style = list(color = "#FEB019"))
)
),
tooltip = list(
fixed = list(
enabled = TRUE,
position = "topLeft",
offsetY = 30L,
offsetX = 60L
)
),
legend = list(horizontalAlign = "left",
offsetX = 40L)
))
kulmak commented
Awesome, thanks a lot for your help!