dreamRs / apexcharter

:bar_chart: R Htmlwidget for ApexCharts.js
https://dreamrs.github.io/apexcharter
Other
138 stars 15 forks source link

Mixed charts #21

Closed Alik-V closed 3 years ago

Alik-V commented 3 years ago

Hi Victor,

Is it currently possible to create mixed charts (bar and line) ?

Best, Alik

pvictor commented 3 years ago

Hello Alik,

Install from GitHub, then you can do :

library(apexcharter)

data("climate_paris")

# Add a line on a column's chart
apex(climate_paris, aes(month, precipitation), type = "column") %>% 
  add_line(aes(month, temperature))

# Add secondary axis
apex(climate_paris, aes(month, precipitation), type = "column") %>% 
  add_line(aes(month, temperature)) %>%
  ax_yaxis(
    title = list(text = "Precipitation (in mm)")
  ) %>% 
  ax_yaxis2(
    opposite = TRUE,
    decimalsInFloat = 0,
    title = list(text = "Temperature (in degree celsius)")
  ) %>% 
  ax_dataLabels(
    enabled = TRUE, enabledOnSeries = list(1)
  )

image

Victor

Alik-V commented 3 years ago

Great, thanks a lot Victor! 👍