Go to file
pvictor cd38b5c5e5 broken link & license 2020-09-09 14:07:59 +02:00
.github updated GitHub actions 2020-06-13 16:05:50 +02:00
R apex: remove NAs in scatter chart (bis) 2020-08-11 09:41:53 +02:00
data new dataset: climate_paris 2020-07-26 10:45:25 +02:00
data-raw new dataset: climate_paris 2020-07-26 10:45:25 +02:00
dev bug non ascii 2020-02-14 18:13:24 +01:00
docs rebuild pkgdown 2020-09-09 12:43:08 +02:00
examples shiny: export base4 dataURI 2020-07-27 18:55:31 +02:00
inst updated apexcharts.js to 3.20.1 2020-09-09 12:39:38 +02:00
man shiny: export base4 dataURI 2020-07-27 18:55:31 +02:00
tests x-axis datetime for column & scatter 2020-04-17 08:57:23 +02:00
vignettes updated NEWS and vignette 2020-06-13 13:04:23 +02:00
.Rbuildignore broken link & license 2020-09-09 14:07:59 +02:00
.gitignore first vignette 2019-02-18 20:29:51 +01:00
.travis.yml rebuild pkkgdown (in docs) 2020-02-15 15:17:46 +01:00
DESCRIPTION updated apexcharts.js to 3.20.1 2020-09-09 12:39:38 +02: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 apex(): remove NAs in scatter chart 2020-08-11 09:41:30 +02:00
NEWS.md updated apexcharts.js to 3.20.1 2020-09-09 12:39:38 +02:00
README.md broken link & license 2020-09-09 14:07:59 +02:00
_pkgdown.yml updated pkgdown 2020-05-27 16:29:28 +02:00
cran-comments.md cran comments 2020-03-31 11:29:22 +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 demo for examples.

version cran checks Travis build status Lifecycle: maturing R build status

⚠️ Use RStudio >= 1.2 to properly display charts

Installation

Install from CRAN with:

install.packages("apexcharter")

Or install the development version from GitHub with:

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

Quick Charts

Use apex function to quickly create visualizations :

library(apexcharter)

data("mpg", package = "ggplot2")
n_manufac <- dplyr::count(mpg, manufacturer)

apex(data = n_manufac, type = "bar", mapping = aes(x = manufacturer, y = n))

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")
n_manufac <- dplyr::count(mpg, manufacturer)

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 = n_manufac$n
  )) %>% 
  ax_colors("#112446") %>% 
  ax_xaxis(categories = n_manufac$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';}")
    )
  )
))