Go to file
pvictor d0fac7c1ee Updated ApexCharts.js to 3.48.0 2024-03-20 10:25:34 +01:00
.github updated test-coverage github action 2023-06-13 18:36:14 +02:00
R maj pkgdown + doc 2024-03-11 11:29:42 +01:00
data added example data 2023-06-14 11:40:03 +02:00
data-raw added example data 2023-06-14 11:40:03 +02:00
examples Updated ApexCharts.js to 3.41.0 2023-06-12 09:51:06 +02:00
inst Updated ApexCharts.js to 3.48.0 2024-03-20 10:25:34 +01:00
man maj pkgdown + doc 2024-03-11 11:29:42 +01:00
man-roxygen added roxygen template for common documentation (ax) 2021-11-17 11:41:10 +01:00
srcjs added ApexCharts to export to fix brush chart in markdown 2021-12-10 18:39:38 +01:00
tests Facets y2 (#65) 2022-12-09 09:36:32 +01:00
vignettes fix heatmap xaxis (force character) 2023-08-23 10:42:59 +02:00
.Rbuildignore Updated ApexCharts.js to 3.35.0 2022-04-02 18:34:43 +02:00
.gitignore added example data 2023-06-14 11:40:03 +02:00
DESCRIPTION Updated ApexCharts.js to 3.46.0 2024-02-21 11:50:04 +01:00
LICENSE broken link & license 2020-09-09 14:07:59 +02:00
LICENSE.md broken link & license 2020-09-09 14:07:59 +02:00
NAMESPACE fix heatmap xaxis (force character) 2023-08-23 10:42:59 +02:00
NEWS.md Updated ApexCharts.js to 3.48.0 2024-03-20 10:25:34 +01:00
README.md prepare for cran 2023-01-08 19:23:11 +01:00
_pkgdown.yml maj pkgdown + doc 2024-03-11 11:29:42 +01:00
codecov.yml removed travis and added coverage 2021-01-07 09:52:06 +01:00
cran-comments.md prepare for cran 2023-01-08 19:23:11 +01:00
package-lock.json Updated ApexCharts.js to 3.48.0 2024-03-20 10:25:34 +01:00
package.json Updated ApexCharts.js to 3.48.0 2024-03-20 10:25:34 +01:00
webpack.common.js updated ApexCharts to 3.29.0 2021-10-20 18:17:27 +02:00
webpack.dev.js use packer 2021-08-20 16:53:55 +02:00
webpack.prod.js use packer 2021-08-20 16:53:55 +02:00

README.md

apexcharter

Htmlwidget for apexcharts.js : A modern JavaScript charting library to build interactive charts and visualizations with simple API. See the online documentation for examples.

CRAN status cran checks Codecov test coverage R-CMD-check

Installation

Install from CRAN with:

install.packages("apexcharter")

Or install the development version from GitHub with:

# install.packages("remotes")
remotes::install_github("dreamRs/apexcharter")

Quick Charts

Use apex function to quickly create visualizations :

library(apexcharter)
data("mpg", package = "ggplot2")
apex(data = mpg, type = "bar", mapping = aes(manufacturer))

With datetime:

data("economics", package = "ggplot2")
apex(data = economics, type = "line", mapping = aes(x = date, y = uempmed)) %>% 
  ax_stroke(width = 1)

Full API

All methods from ApexCharts are available with function like ax_* compatible with pipe from magrittr :

library(apexcharter)
data(mpg, package = "ggplot2")

apexchart() %>% 
  ax_chart(type = "bar") %>% 
  ax_plotOptions(bar = bar_opts(
    horizontal = FALSE,
    endingShape = "flat",
    columnWidth = "70%",
    dataLabels = list(
      position = "top"
    ))
  ) %>% 
  ax_grid(
    show = TRUE,
    position = "front",
    borderColor = "#FFF"
  ) %>% 
  ax_series(list(
    name = "Count",
    data = tapply(mpg$manufacturer, mpg$manufacturer, length)
  )) %>% 
  ax_colors("#112446") %>% 
  ax_xaxis(categories = unique(mpg$manufacturer)) %>% 
  ax_title(text = "Number of models") %>% 
  ax_subtitle(text = "Data from ggplot2")

Raw API

Pass a list of parameters to the function:

apexchart(ax_opts = list(
  chart = list(
    type = "line"
  ),
  stroke = list(
    curve = "smooth"
  ),
  grid = list(
    borderColor = "#e7e7e7",
    row = list(
      colors = c("#f3f3f3", "transparent"),
      opacity = 0.5
    )
  ),
  dataLabels = list(
    enabled = TRUE
  ),
  markers = list(style = "inverted", size = 6),
  series = list(
    list(
      name = "High",
      data = c(28, 29, 33, 36, 32, 32, 33)
    ),
    list(
      name = "Low",
      data = c(12, 11, 14, 18, 17, 13, 13)
    )
  ),
  title = list(
    text = "Average High & Low Temperature",
    align = "left"
  ),
  xaxis = list(
    categories = month.abb[1:7]
  ),
  yaxis = list(
    title = list(text = "Temperature"),
    labels = list(
      formatter = htmlwidgets::JS("function(value) {return value + '\u00b0C';}")
    )
  )
))

Development

This package use {packer} to manage JavaScript assets, see packer's documentation for more.

Install nodes modules with:

packer::npm_install()

Modify srcjs/widgets/apexcharter.js, then run:

packer::bundle()

Re-install R package and try apexcharter() or apex() functions.