From e634a04525c09fb0afe81b7ce801717dad54cfe1 Mon Sep 17 00:00:00 2001 From: pvictor Date: Mon, 29 Jul 2019 09:32:57 +0200 Subject: [PATCH] install from cran --- README.md | 8 +- docs/articles/labs.html | 24 +-- docs/articles/lines.html | 44 +++--- docs/articles/starting-with-apexcharts.html | 64 ++++---- docs/index.html | 164 ++++++++++---------- 5 files changed, 156 insertions(+), 148 deletions(-) diff --git a/README.md b/README.md index ae731c0..b3f6831 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,13 @@ Note: Once again, development is heavily inspired by amazing [highcharter](http: ## Installation -You can install the development version from [GitHub](https://github.com/) with: +Install from CRAN with: + +```r +install.packages("apexcharter") +``` + +Or install the development version from [GitHub](https://github.com/) with: ``` r # install.packages("devtools") diff --git a/docs/articles/labs.html b/docs/articles/labs.html index 39b5585..ae7025e 100644 --- a/docs/articles/labs.html +++ b/docs/articles/labs.html @@ -107,16 +107,16 @@ Chart title
apex(data = n_cut, type = "column", mapping = aes(x = cut, y = n)) %>% 
   ax_title(text = "Cut distribution")
-
-

You can set some options, for example:

+
+

You can set some options, for example:

apex(data = n_cut, type = "column", mapping = aes(x = cut, y = n)) %>% 
   ax_title(
     text = "Cut distribution", 
     align = "center",
     style = list(fontSize = "22px")
   )
-
-

Full list of parameters is available here : https://apexcharts.com/docs/options/title/

+
+

Full list of parameters is available here : https://apexcharts.com/docs/options/title/

@@ -124,8 +124,8 @@
apex(data = n_cut, type = "column", mapping = aes(x = cut, y = n)) %>% 
   ax_title(text = "Cut distribution") %>% 
   ax_subtitle(text = "Data from ggplot2")
-
-

With same options than for title:

+
+

With same options than for title:

apex(data = n_cut, type = "column", mapping = aes(x = cut, y = n)) %>% 
   ax_title(
     text = "Cut distribution", 
@@ -137,8 +137,8 @@
     align = "center",
     style = list(fontSize = "16px", color = "#BDBDBD")
   )
-
-

Full list of parameters is available here : https://apexcharts.com/docs/options/subtitle/

+
+

Full list of parameters is available here : https://apexcharts.com/docs/options/subtitle/

@@ -146,8 +146,8 @@
apex(data = n_cut, type = "column", mapping = aes(x = cut, y = n)) %>% 
   ax_yaxis(title = list(text = "Count")) %>% 
   ax_xaxis(title = list(text = "Cut"))
-
-

With some options:

+
+

With some options:

apex(data = n_cut, type = "column", mapping = aes(x = cut, y = n)) %>% 
   ax_yaxis(title = list(
     text = "Count",
@@ -157,8 +157,8 @@
     text = "Cut", 
     style = list(fontSize = "14px", color = "#BDBDBD")
   ))
-
- +
+

diff --git a/docs/articles/lines.html b/docs/articles/lines.html index 4dd61b0..77fdfbc 100644 --- a/docs/articles/lines.html +++ b/docs/articles/lines.html @@ -113,16 +113,16 @@ Type of line

Classic line:

apex(data = economics, type = "line", mapping = aes(x = date, y = uempmed))
-
-

Spline curve:

+
+

Spline curve:

apex(data = economics, type = "line", mapping = aes(x = date, y = uempmed)) %>% 
   ax_stroke(curve = "smooth")
-
-

Steps chart:

+
+

Steps chart:

apex(data = economics, type = "line", mapping = aes(x = date, y = uempmed)) %>% 
   ax_stroke(curve = "stepline")
-
- +
+

@@ -141,20 +141,20 @@ stops = c(0, 100, 100, 100) ) )

-
-

Solid area color:

+
+

Solid area color:

apex(data = economics, type = "area", mapping = aes(x = date, y = uempmed)) %>% 
   ax_fill(type = "solid", opacity = 1)
-
-

Line width:

+
+

Line width:

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

Dotted line

+
+

Dotted line

apex(data = economics, type = "line", mapping = aes(x = date, y = uempmed)) %>% 
   ax_stroke(dashArray = 6)
-
- +
+

@@ -162,13 +162,13 @@

Add points to line :

apex(data = tail(economics, 20), type = "line", mapping = aes(x = date, y = uempmed)) %>% 
   ax_markers(size = 6)
-
-

Add labels over points

+
+

Add labels over points

apex(data = tail(economics, 20), type = "line", mapping = aes(x = date, y = uempmed)) %>% 
   ax_markers(size = 6) %>% 
   ax_dataLabels(enabled = TRUE)
-
- +
+

@@ -178,12 +178,12 @@ ax_yaxis(decimalsInFloat = 2) %>% ax_markers(size = c(3, 6)) %>% ax_stroke(width = c(1, 3))

-
-
apex(data = economics_long, type = "line", mapping = aes(x = date, y = value01, group = variable)) %>% 
+
+
apex(data = economics_long, type = "line", mapping = aes(x = date, y = value01, group = variable)) %>% 
   ax_yaxis(decimalsInFloat = 2) %>% 
   ax_stroke(dashArray = c(8, 5))
-
- +
+
diff --git a/docs/articles/starting-with-apexcharts.html b/docs/articles/starting-with-apexcharts.html index 69eddb0..d7ddc46 100644 --- a/docs/articles/starting-with-apexcharts.html +++ b/docs/articles/starting-with-apexcharts.html @@ -111,20 +111,20 @@ n_manufac <- count(mpg, manufacturer) apex(data = n_manufac, type = "column", mapping = aes(x = manufacturer, y = n)) -
-

Flipping coordinates can be done by using type = "bar":

+
+

Flipping coordinates can be done by using type = "bar":

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

To create a dodge bar charts, use aesthetic fill :

+
+

To create a dodge bar charts, use aesthetic fill :

n_manufac_year <- count(mpg, manufacturer, year)
 
 apex(data = n_manufac_year, type = "column", mapping = aes(x = manufacturer, y = n, fill = year))
-
-

For stacked bar charts, specify option stacked in ax_chart :

+
+

For stacked bar charts, specify option stacked in ax_chart :

apex(data = n_manufac_year, type = "column", mapping = aes(x = manufacturer, y = n, fill = year)) %>% 
   ax_chart(stacked = TRUE)
-
- +
+

@@ -134,8 +134,8 @@ economics <- tail(economics, 100) apex(data = economics, type = "line", mapping = aes(x = date, y = uempmed))

-
-

To represent several lines, use a data.frame in long format and the group aesthetic:

+
+

To represent several lines, use a data.frame in long format and the group aesthetic:

data("economics_long")
 economics_long <- economics_long %>% 
   group_by(variable) %>% 
@@ -143,29 +143,29 @@
 
 apex(data = economics_long, type = "line", mapping = aes(x = date, y = value01, group = variable)) %>% 
   ax_yaxis(decimalsInFloat = 2) # number of decimals to keep
-
-

Create area charts with type = "area":

+
+

Create area charts with type = "area":

apex(data = economics_long, type = "area", mapping = aes(x = date, y = value01, fill = variable)) %>% 
   ax_yaxis(decimalsInFloat = 2) %>% # number of decimals to keep
   ax_chart(stacked = TRUE) %>%
   ax_yaxis(max = 4, tickAmount = 4)
-
- +
+

Scatter charts

Simple bar charts can be created with:

apex(data = mtcars, type = "scatter", mapping = aes(x = wt, y = mpg))
-
-

Color points according to a third variable:

+
+

Color points according to a third variable:

apex(data = mtcars, type = "scatter", mapping = aes(x = wt, y = mpg, fill = cyl)) %>%
   ax_xaxis(tickAmount = 5)
-
-

And change point size using z aesthetics:

+
+

And change point size using z aesthetics:

apex(data = mtcars, type = "scatter", mapping = aes(x = wt, y = mpg, z = scales::rescale(qsec)))
-
- +
+

@@ -177,24 +177,24 @@ ) apex(data = poll, type = "pie", mapping = aes(x = answer, y = n))

-
- +
+

Radial charts

Simple radial charts can be created with (here we pass values directly in aes, but you can use a data.frame) :

apex(data = NULL, type = "radialBar", mapping = aes(x = "My value", y = 65))
-
-

Multi radial chart (more than one value):

+
+

Multi radial chart (more than one value):

fruits <- data.frame(
   name = c('Apples', 'Oranges', 'Bananas', 'Berries'),
   value = c(44, 55, 67, 83)
 )
 
 apex(data = fruits, type = "radialBar", mapping = aes(x = name, y = value))
-
- +
+

@@ -203,8 +203,8 @@
mtcars$model <- rownames(mtcars)
 
 apex(data = head(mtcars), type = "radar", mapping = aes(x = model, y = qsec))
-
-

With a grouping variable:

+
+

With a grouping variable:

# extremely complicated reshaping
 new_mtcars <- reshape(
   data = head(mtcars), 
@@ -217,8 +217,8 @@
 )
 
 apex(data = new_mtcars, type = "radar", mapping = aes(x = model, y = value, group = time))
-
- +
+

@@ -235,8 +235,8 @@ ) %>% ax_dataLabels(enabled = FALSE) %>% ax_colors("#008FFB")

-
- +
+ diff --git a/docs/index.html b/docs/index.html index 470c359..10c4e97 100644 --- a/docs/index.html +++ b/docs/index.html @@ -99,106 +99,108 @@

Installation

-

You can install the development version from GitHub with:

- +

Install from CRAN with:

+
install.packages("apexcharter")
+

Or install the development version from GitHub with:

+

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))
+
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)
+
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")
+
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:

- +

alt text