diff --git a/DESCRIPTION b/DESCRIPTION
index 7fb308d1..31ec8f5c 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -6,7 +6,7 @@ Description: A wrapper for the 'Highcharts' library including
shortcut functions to plot R objects. 'Highcharts'
is a charting library offering
numerous chart types with a simple configuration syntax.
-Date: 2015-12-11
+Date: 2016-01-12
Author: Joshua Kunst
Maintainer: Joshua Kunst
License: MIT + file LICENSE
diff --git a/R/api.R b/R/api.R
index 86b2e3ec..8a35d998 100644
--- a/R/api.R
+++ b/R/api.R
@@ -1,7 +1,7 @@
-#' @import rlist assertthat
+#' @import rlist
.hc_opt <- function(hc, name, ...) {
- assert_that(.is_highchart(hc))
+ assertthat::assert_that(.is_highchart(hc))
if (is.null(hc$x$hc_opts[[name]])) {
@@ -204,9 +204,10 @@ hc_tooltip <- function(hc, ...) {
#' The plotOptions is a wrapper object for config objects for each series type. The config
#' objects for each series can also be overridden for each series item as given in the series array.
#'
-#' Configuration options for the series are given in three levels. Options for all series in a chart are given in the
-#' plotOptions object. Then options for all series of a specific type are given in the plotOptions of that type, for example
-#' \code{hc_plotOptions(line = list(...))}. Next, options for one single series are given in the series array.
+#' Configuration options for the series are given in three levels. Options for all series in a
+#' chart are given with the \code{hc_plotOptions} function. Then options for all series of a specific
+#' type are given in the plotOptions of that type, for example \code{hc_plotOptions(line = list(...))}.
+#' Next, options for one single series are given in the series array.
#'
#' @param hc A \code{highchart} \code{htmlwidget} object.
#' @param ... Arguments are defined in \url{http://api.highcharts.com/highcharts#plotOptions}.
@@ -232,7 +233,7 @@ hc_tooltip <- function(hc, ...) {
#'
#' hc
#'
-#' #' override the `blue` option with the explicit parameter
+#' # override the `blue` option with the explicit parameter
#' hc %>%
#' hc_add_serie(name = "London",
#' data = citytemp$new_york,
@@ -247,12 +248,24 @@ hc_plotOptions <- function(hc, ...) {
#' Adding credits options to highchart objects
#'
-#' \code{highcarter} by default don't put credits label. You can add credits
-#' using these options.
+#' \code{highcarter} by default don't put credits in the chart.
+#' You can add credits using these options.
#'
#' @param hc A \code{highchart} \code{htmlwidget} object.
#' @param ... Arguments defined in \url{http://api.highcharts.com/highcharts#credits}.
-#'
+#'
+#' @examples
+#'
+#' require("dplyr")
+#'
+#' data("citytemp")
+#'
+#' highchart() %>%
+#' hc_xAxis(categories = citytemp$month) %>%
+#' hc_add_serie(name = "Tokyo", data = citytemp$tokyo, type = "bar") %>%
+#' hc_credits(enabled = TRUE, text = "htmlwidgets.org",
+#' href = "http://www.htmlwidgets.org/")
+#'
#' @export
hc_credits <- function(hc, ...) {
@@ -266,7 +279,41 @@ hc_credits <- function(hc, ...) {
#'
#' @param hc A \code{highchart} \code{htmlwidget} object.
#' @param ... Arguments are defined in \url{http://www.highcharts.com/docs/maps/color-axis}.
-#'
+#'
+#' @examples
+#'
+#' require("dplyr")
+#'
+#' nyears <- 5
+#'
+#' df <- expand.grid(seq(12) - 1, seq(nyears) - 1)
+#' df$value <- abs(seq(nrow(df)) + 10 * rnorm(nrow(df))) + 10
+#' df$value <- round(df$value, 2)
+#' ds <- setNames(list.parse2(df), NULL)
+#'
+#'
+#' hc <- highchart() %>%
+#' hc_chart(type = "heatmap") %>%
+#' hc_title(text = "Simulated values by years and months") %>%
+#' hc_xAxis(categories = month.abb) %>%
+#' hc_yAxis(categories = 2016 - nyears + seq(nyears)) %>%
+#' hc_add_serie(name = "value", data = ds)
+#'
+#' hc_colorAxis(hc, minColor = "#FFFFFF", maxColor = "#434348")
+#'
+#' hc_colorAxis(hc, minColor = "#FFFFFF", maxColor = "#434348",
+#' type = "logarithmic")
+#'
+#'
+#' require("viridisLite")
+#'
+#' n <- 4
+#' stops <- data_frame(q = 0:n/n,
+#' c = substring(viridis(n + 1), 0, 7))
+#' stops <- list.parse2(stops)
+#'
+#' hc_colorAxis(hc, stops = stops, max = 75)
+#'
#' @export
hc_colorAxis <- function(hc, ...) {
@@ -292,14 +339,8 @@ hc_colorAxis <- function(hc, ...) {
#' hc_xAxis(categories = citytemp$month) %>%
#' hc_add_serie(name = "Tokyo", data = citytemp$tokyo) %>%
#' hc_add_serie(name = "London", data = citytemp$london) %>%
-#' hc_exporting(enabled = FALSE)
-#'
-#'
-#' highchart() %>%
-#' hc_xAxis(categories = citytemp$month) %>%
-#' hc_add_serie(name = "Tokyo", data = citytemp$tokyo) %>%
-#' hc_add_serie(name = "London", data = citytemp$london) %>%
-#' hc_exporting(filename = "custom-file-name")
+#' hc_exporting(enabled = TRUE,
+#' filename = "custom-file-name")
#'
#' @export
hc_exporting <- function(hc, ...) {
@@ -341,11 +382,9 @@ hc_add_serie <- function(hc, ...) {
#' Removing series to highchart objects
#'
-#' @param hc A \code{highchart} \code{htmlwidget} object.
#' @param name The serie's name to delete.
#'
#' @rdname hc_add_serie
-#'
#' @export
hc_rm_serie <- function(hc, name = NULL) {
diff --git a/R/assertthat.R b/R/assertthat.R
index 3c15e3a1..66354111 100644
--- a/R/assertthat.R
+++ b/R/assertthat.R
@@ -1,5 +1,6 @@
+#' @import assertthat
.is_highchart <- function(hc){
- are_equal(class(hc), c("highchart", "htmlwidget"))
+ assertthat::are_equal(class(hc), c("highchart", "htmlwidget"))
}
assertthat::on_failure(.is_highchart) <- function(call, env) {
@@ -9,11 +10,11 @@ assertthat::on_failure(.is_highchart) <- function(call, env) {
}
.is_hc_theme <- function(hc_theme){
- are_equal(class(hc_theme), "hc_theme")
+ assertthat::are_equal(class(hc_theme), "hc_theme")
}
assertthat::on_failure(.is_highchart) <- function(call, env) {
- "The theme used is not a hc_theme object"
+ "The theme used is not from hc_theme class"
}
diff --git a/R/data-citytemp.R b/R/data-citytemp.R
index 820fb833..e5c6025f 100644
--- a/R/data-citytemp.R
+++ b/R/data-citytemp.R
@@ -18,7 +18,6 @@
#' @name citytemp
#' @usage citytemp
#' @format A \code{data frame} with 12 observations and 5 variables.
-#' @rdname data
#' @examples
#' data(citytemp)
#' citytemp
diff --git a/R/data-favorite_bars.R b/R/data-favorite_bars.R
index 2d879584..2eb07309 100644
--- a/R/data-favorite_bars.R
+++ b/R/data-favorite_bars.R
@@ -15,7 +15,6 @@
#' @name favorite_bars
#' @usage favorite_bars
#' @format A \code{data frame} with 5 observations and 2 variables.
-#' @rdname data
#' @examples
#' data(favorite_bars)
#' favorite_bars
diff --git a/R/data-favorite_pies.R b/R/data-favorite_pies.R
index 425ea26b..7edf9607 100644
--- a/R/data-favorite_pies.R
+++ b/R/data-favorite_pies.R
@@ -15,7 +15,6 @@
#' @name favorite_pies
#' @usage favorite_pies
#' @format A \code{data frame} with 5 observations and 2 variables.
-#' @rdname data
#' @examples
#' data(favorite_pies)
#' favorite_pies
diff --git a/R/helpers.R b/R/helpers.R
index b5cda148..086d9af1 100644
--- a/R/helpers.R
+++ b/R/helpers.R
@@ -2,14 +2,20 @@
#'
#' This function is similiar to \code{rlist::list.parse} but this removes names.
#'
-#' @param df A data frame to
+#' @param df A data frame to parse to list
#'
-#' @importFrom stats setNames
+#' @examples
+#'
+#' x <- data.frame(a=1:3,type=c('A','C','B'))
+#'
+#' list.parse2(x)
#'
-#' @rdname helpers
+#' @importFrom stats setNames
#' @export
list.parse2 <- function(df) {
+ assertthat::assert_that(is.data.frame(df))
+
setNames(apply(df, 1, function(r) as.list(as.vector(r))), NULL)
}
@@ -20,18 +26,22 @@ list.parse2 <- function(df) {
#'
#' @param x A vector string.
#'
+#' @examples
+#'
+#' str_to_id(" A string _ with Underscores ")
+#'
#' @importFrom stringr str_to_lower str_replace_all
-#' @rdname helpers
#' @export
str_to_id <- function(x) {
- assert_that(is.character(x))
+ assertthat::assert_that(is.character(x))
x %>%
str_trim() %>%
str_to_lower() %>%
str_replace_all("\\s+", "_") %>%
- iconv("latin1", "ASCII", sub="")
+ str_replace_all("_+", "_") %>%
+ iconv("latin1", "ASCII", sub = "")
}
@@ -39,7 +49,10 @@ str_to_id <- function(x) {
#'
#' Get color used in highcharts charts.
#'
-#' @rdname helpers
+#' @examples
+#'
+#' hc_get_colors()[1:5]
+#'
#' @export
hc_get_colors <- function() {
@@ -50,13 +63,16 @@ hc_get_colors <- function() {
#' Get dash styles
#'
-#' Get dash style to use on hichartrs objects.
+#' Get dash style to use on highcharts objects.
+#'
+#' @examples
+#'
+#' hc_get_dash_styles()[1:5]
#'
-#' @rdname helpers
#' @export
hc_get_dash_styles <- function() {
- c("Solid", "ShortDash", "ShortDot", "ShortDashDot", "ShortDashDotDot", "Dot",
- "Dash", "LongDash", "DashDot", "LongDashDot", "LongDashDotDot")
+ c("Solid", "ShortDash", "ShortDot", "ShortDashDot", "ShortDashDotDot",
+ "Dot", "Dash", "LongDash", "DashDot", "LongDashDot", "LongDashDotDot")
}
diff --git a/R/highcharter-package.R b/R/highcharter-package.R
index 26df0e09..5ff2e1f8 100644
--- a/R/highcharter-package.R
+++ b/R/highcharter-package.R
@@ -1,5 +1,10 @@
#' An \code{htmlwidget} interface to the
-#' \href{http://www.highcharts.com/}{Highcharts} javascript chart library
+#' Highcharts javascript chart library
+#'
+#' Highcarts \url{http://www.highcharts.com/} is a mature javascript
+#' charting library. Highcharts provide a various type of charts, from
+#' scatters to heatmaps or treemaps.
+#'
#' @name hicharter
#' @docType package
#' @author Joshua Kunst (@@jbkunst)
diff --git a/R/shortcuts.R b/R/shortcuts.R
index b76189ab..b109616c 100644
--- a/R/shortcuts.R
+++ b/R/shortcuts.R
@@ -29,7 +29,7 @@
#' @export
hc_add_serie_ts2 <- function(hc, ts, ...) {
- assert_that(is.ts(ts), .is_highchart(hc))
+ assertthat::assert_that(is.ts(ts), .is_highchart(hc))
# http://stackoverflow.com/questions/29202021/r-how-to-extract-dates-from-a-time-series
dates <- time(ts) %>%
@@ -59,8 +59,8 @@ hc_add_serie_ts2 <- function(hc, ts, ...) {
#' require("ggplot2")
#' data(economics, package = "ggplot2")
#'
-#' hc_add_serie_ts(highchart(),
-#' economics$psavert, economics$date,
+#' hc_add_serie_ts(hc = highchart(),
+#' values = economics$psavert, dates = economics$date,
#' name = "Personal Savings Rate")
#' }
#'
@@ -69,7 +69,7 @@ hc_add_serie_ts2 <- function(hc, ts, ...) {
#' @export
hc_add_serie_ts <- function(hc, values, dates, ...) {
- assert_that(.is_highchart(hc), is.numeric(values), is.date(dates))
+ assertthat::assert_that(.is_highchart(hc), is.numeric(values), is.date(dates))
timestamps <- dates %>%
zoo::as.Date() %>%
@@ -148,8 +148,8 @@ hc_add_serie_ts <- function(hc, values, dates, ...) {
hc_add_serie_scatter <- function(hc, x, y, z = NULL, color = NULL, label = NULL,
showInLegend = FALSE, viridis.option = "D", ...) {
- assert_that(.is_highchart(hc), length(x) == length(y),
- is.numeric(x), is.numeric(y))
+ assertthat::assert_that(.is_highchart(hc), length(x) == length(y),
+ is.numeric(x), is.numeric(y))
df <- data_frame(x, y)
@@ -228,9 +228,9 @@ hc_add_serie_scatter <- function(hc, x, y, z = NULL, color = NULL, label = NULL,
#' @export
hc_add_serie_labels_values <- function(hc, labels, values, colors = NULL, ...) {
- assert_that(.is_highchart(hc),
- is.numeric(values),
- length(labels) == length(values))
+ assertthat::assert_that(.is_highchart(hc),
+ is.numeric(values),
+ length(labels) == length(values))
df <- data_frame(name = labels, y = values)
@@ -292,8 +292,8 @@ hc_add_serie_labels_values <- function(hc, labels, values, colors = NULL, ...) {
#' @export
hc_add_serie_treemap <- function(hc, tm, ...) {
- assert_that(.is_highchart(hc),
- is.list(tm))
+ assertthat::assert_that(.is_highchart(hc),
+ is.list(tm))
df <- tm$tm %>%
tbl_df() %>%
diff --git a/R/theme.R b/R/theme.R
index db0fcf78..696a3f44 100644
--- a/R/theme.R
+++ b/R/theme.R
@@ -2,6 +2,8 @@
#'
#' Function to create highcharts themes.
#'
+#' More examples are in http://www.highcharts.com/docs/chart-design-and-style/themes.
+#'
#' @param ... A named list with the parameters.
#'
#' @examples
@@ -64,6 +66,16 @@ hc_theme <- function(...){
#' @param hc A highchart object
#' @param hc_thm A highchart theme object (\code{"hc_theme"} class)
#'
+#' @examples
+#'
+#' require("dplyr")
+#'
+#' highchart() %>%
+#' hc_add_serie(data = c(7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2,
+#' 26.5, 23.3, 18.3, 13.9, 9.6),
+#' type = "column") %>%
+#' hc_add_theme(hc_theme_sandsignika())
+#'
#' @export
hc_add_theme <- function(hc, hc_thm){
@@ -84,6 +96,24 @@ hc_add_theme <- function(hc, hc_thm){
#'
#' @param ... A \code{hc_theme} objects.
#'
+#' @examples
+#'
+#' thm <- hc_theme_merge(
+#' hc_theme_darkunica(),
+#' hc_theme(
+#' chart = list(
+#' backgroundColor = "transparent",
+#' divBackgroundImage = "http://cdn.wall-pix.net/albums/art-3Dview/00025095.jpg"
+#' ),
+#' title = list(
+#' style = list(
+#' color = 'white',
+#' fontFamily = "Erica One"
+#' )
+#' )
+#' )
+#' )
+#'
#' @export
hc_theme_merge <- function(...){
diff --git a/R/zzz.R b/R/zzz.R
index e46a74d3..c643a1d2 100644
--- a/R/zzz.R
+++ b/R/zzz.R
@@ -36,6 +36,9 @@
),
credits = list(
enabled = FALSE
+ ),
+ exporting = list(
+ enabled = FALSE
)
)
))
diff --git a/README.md b/README.md
index 3b281638..d903277b 100644
--- a/README.md
+++ b/README.md
@@ -6,16 +6,29 @@ Another R wrapper for highchartsjs
[![version](http://www.r-pkg.org/badges/version/highcharter)](http://www.r-pkg.org/pkg/highcharter)
[![downloads](http://cranlogs.r-pkg.org/badges/highcharter)](http://www.r-pkg.org/pkg/highcharter)
-## Licence
+## Why highcharter?
+
+- [Various](http://jkunst.com/highcharter/#shorcuts-for-add-data-data-series) chart type with the same style (scatters, time series, heatmaps, treemap, more coming soon).
+- [Themes](http://jkunst.com/highcharter/#themes): Add themes, merge themes or create your own.
+- [Piping styling](http://jkunst.com/highcharter/#quick-demo).
+
+## Future Work
-http://shop.highsoft.com/highcharts.html
+- Add highmaps as htmlwidget.
+- Add highstock as htmlwidget.
+- Add [*ggfortify*-like](https://github.com/sinhrks/ggfortify) funcionalities. This is plot a lot
+of **R** objects with `hcplot(x)`.
-Highcharts is free for personal or non profit projects under the
+## Licence
+
+`highcharter` is licensed under the MIT License. However, highcharts.com is licensed under
+their own terms. Highcharts is free for personal or non profit projects under the
[Creative Commons Attribution-NonCommercial 3.0 License](http://creativecommons.org/licenses/by-nc/3.0/).
## WIP
See some examples in:
+
- http://jkunst.com/highcharter/
- http://rpubs.com/jbkunst/highcharter
- http://rpubs.com/jbkunst/highcharter-test-01
diff --git a/cran-comments.md b/cran-comments.md
index d546e553..1df814c5 100644
--- a/cran-comments.md
+++ b/cran-comments.md
@@ -1,8 +1,9 @@
## Resubmission
-This is a resubmission. In this version I have:
+This is a resubmission. In this version I fix/have:
-* Description of highcharts library
-* Adding import from stat package: ecdf
+* More dateiled descriptions in manual pages.
+* Adding examples for every exported function (whithout \dontrun).
+* Adding "<>" to link highcharts.com in the description.
-Regards,
+Thanks. Regards,
diff --git a/man/citytemp.Rd b/man/citytemp.Rd
new file mode 100644
index 00000000..ef1e2a9e
--- /dev/null
+++ b/man/citytemp.Rd
@@ -0,0 +1,31 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/data-citytemp.R
+\docType{data}
+\name{citytemp}
+\alias{citytemp}
+\title{City temperatures from a year}
+\format{A \code{data frame} with 12 observations and 5 variables.}
+\usage{
+citytemp
+}
+\description{
+This data comes from the \url{http://www.highcharts.com/} examples.
+}
+\section{Variables}{
+
+
+\itemize{
+
+ \item \code{month}: The months.
+ \item \code{tokyo}: Tokyo's temperatures.
+ \item \code{new_york}: New york's temperatures.
+ \item \code{berlin}: Berlin's temperatures.
+ \item \code{london}: Londo's temperatures.
+
+}
+}
+\examples{
+data(citytemp)
+citytemp
+}
+
diff --git a/man/data.Rd b/man/data.Rd
deleted file mode 100644
index 196eb9e7..00000000
--- a/man/data.Rd
+++ /dev/null
@@ -1,63 +0,0 @@
-% Generated by roxygen2: do not edit by hand
-% Please edit documentation in R/data-citytemp.R, R/data-favorite_bars.R, R/data-favorite_pies.R
-\docType{data}
-\name{citytemp}
-\alias{citytemp}
-\alias{favorite_bars}
-\alias{favorite_pies}
-\title{City temperatures from a year}
-\format{A \code{data frame} with 12 observations and 5 variables.}
-\usage{
-citytemp
-
-favorite_bars
-
-favorite_pies
-}
-\description{
-This data comes from the \url{http://www.highcharts.com/} examples.
-
-Data from How I met Your Mother: Marshall's Favorite Bars.
-
-Data from How I met Your Mother: Marshall's Favorite Pies
-}
-\section{Variables}{
-
-
-\itemize{
-
- \item \code{month}: The months.
- \item \code{tokyo}: Tokyo's temperatures.
- \item \code{new_york}: New york's temperatures.
- \item \code{berlin}: Berlin's temperatures.
- \item \code{london}: Londo's temperatures.
-
-}
-
-
-
-\itemize{
-
- \item \code{bar}: Bar's name.
- \item \code{percent}: In percentage of awesomeness
-
-}
-
-
-
-\itemize{
-
- \item \code{pie}: Bar's name.
- \item \code{percent}: In percentage of tastiness
-
-}
-}
-\examples{
-data(citytemp)
-citytemp
-data(favorite_bars)
-favorite_bars
-data(favorite_pies)
-favorite_pies
-}
-
diff --git a/man/favorite_bars.Rd b/man/favorite_bars.Rd
new file mode 100644
index 00000000..26933f08
--- /dev/null
+++ b/man/favorite_bars.Rd
@@ -0,0 +1,28 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/data-favorite_bars.R
+\docType{data}
+\name{favorite_bars}
+\alias{favorite_bars}
+\title{Marshall's Favorite Bars}
+\format{A \code{data frame} with 5 observations and 2 variables.}
+\usage{
+favorite_bars
+}
+\description{
+Data from How I met Your Mother: Marshall's Favorite Bars.
+}
+\section{Variables}{
+
+
+\itemize{
+
+ \item \code{bar}: Bar's name.
+ \item \code{percent}: In percentage of awesomeness
+
+}
+}
+\examples{
+data(favorite_bars)
+favorite_bars
+}
+
diff --git a/man/favorite_pies.Rd b/man/favorite_pies.Rd
new file mode 100644
index 00000000..256b9b22
--- /dev/null
+++ b/man/favorite_pies.Rd
@@ -0,0 +1,28 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/data-favorite_pies.R
+\docType{data}
+\name{favorite_pies}
+\alias{favorite_pies}
+\title{Marshall's Favorite Pies}
+\format{A \code{data frame} with 5 observations and 2 variables.}
+\usage{
+favorite_pies
+}
+\description{
+Data from How I met Your Mother: Marshall's Favorite Pies
+}
+\section{Variables}{
+
+
+\itemize{
+
+ \item \code{pie}: Bar's name.
+ \item \code{percent}: In percentage of tastiness
+
+}
+}
+\examples{
+data(favorite_pies)
+favorite_pies
+}
+
diff --git a/man/hc_add_serie.Rd b/man/hc_add_serie.Rd
index a46070d5..38e303a3 100644
--- a/man/hc_add_serie.Rd
+++ b/man/hc_add_serie.Rd
@@ -15,8 +15,6 @@ hc_rm_serie(hc, name = NULL)
\item{...}{Arguments defined in \url{http://api.highcharts.com/highcharts#chart}.}
\item{name}{The serie's name to delete.}
-
-\item{hc}{A \code{highchart} \code{htmlwidget} object.}
}
\description{
Adding and removing series from highchart objects
diff --git a/man/hc_add_serie_ts.Rd b/man/hc_add_serie_ts.Rd
index a266e510..ea30c4cd 100644
--- a/man/hc_add_serie_ts.Rd
+++ b/man/hc_add_serie_ts.Rd
@@ -28,8 +28,8 @@ This function \bold{modify} the type of \code{chart} to \code{datetime}
require("ggplot2")
data(economics, package = "ggplot2")
-hc_add_serie_ts(highchart(),
- economics$psavert, economics$date,
+hc_add_serie_ts(hc = highchart(),
+ values = economics$psavert, dates = economics$date,
name = "Personal Savings Rate")
}
diff --git a/man/hc_add_theme.Rd b/man/hc_add_theme.Rd
index bac737df..0f41a811 100644
--- a/man/hc_add_theme.Rd
+++ b/man/hc_add_theme.Rd
@@ -14,4 +14,15 @@ hc_add_theme(hc, hc_thm)
\description{
Add highcharts themes to a highchart object.
}
+\examples{
+
+require("dplyr")
+
+highchart() \%>\%
+ hc_add_serie(data = c(7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2,
+ 26.5, 23.3, 18.3, 13.9, 9.6),
+ type = "column") \%>\%
+ hc_add_theme(hc_theme_sandsignika())
+
+}
diff --git a/man/hc_colorAxis.Rd b/man/hc_colorAxis.Rd
index e3eff884..9257b1a5 100644
--- a/man/hc_colorAxis.Rd
+++ b/man/hc_colorAxis.Rd
@@ -14,4 +14,39 @@ hc_colorAxis(hc, ...)
\description{
Function to set the axis color to highcharts objects.
}
+\examples{
+
+require("dplyr")
+
+nyears <- 5
+
+df <- expand.grid(seq(12) - 1, seq(nyears) - 1)
+df$value <- abs(seq(nrow(df)) + 10 * rnorm(nrow(df))) + 10
+df$value <- round(df$value, 2)
+ds <- setNames(list.parse2(df), NULL)
+
+
+hc <- highchart() \%>\%
+ hc_chart(type = "heatmap") \%>\%
+ hc_title(text = "Simulated values by years and months") \%>\%
+ hc_xAxis(categories = month.abb) \%>\%
+ hc_yAxis(categories = 2016 - nyears + seq(nyears)) \%>\%
+ hc_add_serie(name = "value", data = ds)
+
+hc_colorAxis(hc, minColor = "#FFFFFF", maxColor = "#434348")
+
+hc_colorAxis(hc, minColor = "#FFFFFF", maxColor = "#434348",
+ type = "logarithmic")
+
+
+require("viridisLite")
+
+n <- 4
+stops <- data_frame(q = 0:n/n,
+ c = substring(viridis(n + 1), 0, 7))
+stops <- list.parse2(stops)
+
+hc_colorAxis(hc, stops = stops, max = 75)
+
+}
diff --git a/man/hc_credits.Rd b/man/hc_credits.Rd
index c035a1ec..3bb68b2e 100644
--- a/man/hc_credits.Rd
+++ b/man/hc_credits.Rd
@@ -12,7 +12,20 @@ hc_credits(hc, ...)
\item{...}{Arguments defined in \url{http://api.highcharts.com/highcharts#credits}.}
}
\description{
-\code{highcarter} by default don't put credits label. You can add credits
-using these options.
+\code{highcarter} by default don't put credits in the chart.
+You can add credits using these options.
+}
+\examples{
+
+require("dplyr")
+
+data("citytemp")
+
+highchart() \%>\%
+ hc_xAxis(categories = citytemp$month) \%>\%
+ hc_add_serie(name = "Tokyo", data = citytemp$tokyo, type = "bar") \%>\%
+ hc_credits(enabled = TRUE, text = "htmlwidgets.org",
+ href = "http://www.htmlwidgets.org/")
+
}
diff --git a/man/hc_exporting.Rd b/man/hc_exporting.Rd
index 233581c0..6434712b 100644
--- a/man/hc_exporting.Rd
+++ b/man/hc_exporting.Rd
@@ -25,14 +25,8 @@ highchart() \%>\%
hc_xAxis(categories = citytemp$month) \%>\%
hc_add_serie(name = "Tokyo", data = citytemp$tokyo) \%>\%
hc_add_serie(name = "London", data = citytemp$london) \%>\%
- hc_exporting(enabled = FALSE)
-
-
-highchart() \%>\%
- hc_xAxis(categories = citytemp$month) \%>\%
- hc_add_serie(name = "Tokyo", data = citytemp$tokyo) \%>\%
- hc_add_serie(name = "London", data = citytemp$london) \%>\%
- hc_exporting(filename = "custom-file-name")
+ hc_exporting(enabled = TRUE,
+ filename = "custom-file-name")
}
diff --git a/man/hc_get_colors.Rd b/man/hc_get_colors.Rd
new file mode 100644
index 00000000..2fc48a6d
--- /dev/null
+++ b/man/hc_get_colors.Rd
@@ -0,0 +1,17 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/helpers.R
+\name{hc_get_colors}
+\alias{hc_get_colors}
+\title{Get default colors for Highcharts theme}
+\usage{
+hc_get_colors()
+}
+\description{
+Get color used in highcharts charts.
+}
+\examples{
+
+hc_get_colors()[1:5]
+
+}
+
diff --git a/man/hc_get_dash_styles.Rd b/man/hc_get_dash_styles.Rd
new file mode 100644
index 00000000..560eee19
--- /dev/null
+++ b/man/hc_get_dash_styles.Rd
@@ -0,0 +1,17 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/helpers.R
+\name{hc_get_dash_styles}
+\alias{hc_get_dash_styles}
+\title{Get dash styles}
+\usage{
+hc_get_dash_styles()
+}
+\description{
+Get dash style to use on highcharts objects.
+}
+\examples{
+
+hc_get_dash_styles()[1:5]
+
+}
+
diff --git a/man/hc_plotOptions.Rd b/man/hc_plotOptions.Rd
index 5caa248f..8ae6e8d6 100644
--- a/man/hc_plotOptions.Rd
+++ b/man/hc_plotOptions.Rd
@@ -16,9 +16,10 @@ The plotOptions is a wrapper object for config objects for each series type. The
objects for each series can also be overridden for each series item as given in the series array.
}
\details{
-Configuration options for the series are given in three levels. Options for all series in a chart are given in the
-plotOptions object. Then options for all series of a specific type are given in the plotOptions of that type, for example
-\code{hc_plotOptions(line = list(...))}. Next, options for one single series are given in the series array.
+Configuration options for the series are given in three levels. Options for all series in a
+chart are given with the \code{hc_plotOptions} function. Then options for all series of a specific
+type are given in the plotOptions of that type, for example \code{hc_plotOptions(line = list(...))}.
+Next, options for one single series are given in the series array.
}
\examples{
@@ -41,7 +42,7 @@ hc <- highchart() \%>\%
hc
-#' override the `blue` option with the explicit parameter
+# override the `blue` option with the explicit parameter
hc \%>\%
hc_add_serie(name = "London",
data = citytemp$new_york,
diff --git a/man/hc_theme.Rd b/man/hc_theme.Rd
index 2f37392a..404b28c9 100644
--- a/man/hc_theme.Rd
+++ b/man/hc_theme.Rd
@@ -12,6 +12,9 @@ hc_theme(...)
\description{
Function to create highcharts themes.
}
+\details{
+More examples are in http://www.highcharts.com/docs/chart-design-and-style/themes.
+}
\examples{
require("dplyr")
diff --git a/man/hc_theme_merge.Rd b/man/hc_theme_merge.Rd
index 5faf443a..e42b4b5a 100644
--- a/man/hc_theme_merge.Rd
+++ b/man/hc_theme_merge.Rd
@@ -12,4 +12,23 @@ hc_theme_merge(...)
\description{
Function to combine hc_theme objects.
}
+\examples{
+
+thm <- hc_theme_merge(
+ hc_theme_darkunica(),
+ hc_theme(
+ chart = list(
+ backgroundColor = "transparent",
+ divBackgroundImage = "http://cdn.wall-pix.net/albums/art-3Dview/00025095.jpg"
+ ),
+ title = list(
+ style = list(
+ color = 'white',
+ fontFamily = "Erica One"
+ )
+ )
+ )
+)
+
+}
diff --git a/man/helpers.Rd b/man/helpers.Rd
deleted file mode 100644
index 3a518fd7..00000000
--- a/man/helpers.Rd
+++ /dev/null
@@ -1,32 +0,0 @@
-% Generated by roxygen2: do not edit by hand
-% Please edit documentation in R/helpers.R
-\name{list.parse2}
-\alias{hc_get_colors}
-\alias{hc_get_dash_styles}
-\alias{list.parse2}
-\alias{str_to_id}
-\title{Convert an object to list with identical structure}
-\usage{
-list.parse2(df)
-
-str_to_id(x)
-
-hc_get_colors()
-
-hc_get_dash_styles()
-}
-\arguments{
-\item{df}{A data frame to}
-
-\item{x}{A vector string.}
-}
-\description{
-This function is similiar to \code{rlist::list.parse} but this removes names.
-
-Turn a string to \code{id} format used in treemaps.
-
-Get color used in highcharts charts.
-
-Get dash style to use on hichartrs objects.
-}
-
diff --git a/man/hicharter.Rd b/man/hicharter.Rd
index 7cc10178..aa365d6b 100644
--- a/man/hicharter.Rd
+++ b/man/hicharter.Rd
@@ -5,10 +5,11 @@
\alias{hicharter}
\alias{hicharter-package}
\title{An \code{htmlwidget} interface to the
-\href{http://www.highcharts.com/}{Highcharts} javascript chart library}
+Highcharts javascript chart library}
\description{
-An \code{htmlwidget} interface to the
-\href{http://www.highcharts.com/}{Highcharts} javascript chart library
+Highcarts \url{http://www.highcharts.com/} is a mature javascript
+charting library. Highcharts provide a various type of charts, from
+scatters to heatmaps or treemaps.
}
\author{
Joshua Kunst (@jbkunst)
diff --git a/man/list.parse2.Rd b/man/list.parse2.Rd
new file mode 100644
index 00000000..0f895de4
--- /dev/null
+++ b/man/list.parse2.Rd
@@ -0,0 +1,22 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/helpers.R
+\name{list.parse2}
+\alias{list.parse2}
+\title{Convert an object to list with identical structure}
+\usage{
+list.parse2(df)
+}
+\arguments{
+\item{df}{A data frame to parse to list}
+}
+\description{
+This function is similiar to \code{rlist::list.parse} but this removes names.
+}
+\examples{
+
+x <- data.frame(a=1:3,type=c('A','C','B'))
+
+list.parse2(x)
+
+}
+
diff --git a/man/str_to_id.Rd b/man/str_to_id.Rd
new file mode 100644
index 00000000..6b8128eb
--- /dev/null
+++ b/man/str_to_id.Rd
@@ -0,0 +1,20 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/helpers.R
+\name{str_to_id}
+\alias{str_to_id}
+\title{String to 'id' format}
+\usage{
+str_to_id(x)
+}
+\arguments{
+\item{x}{A vector string.}
+}
+\description{
+Turn a string to \code{id} format used in treemaps.
+}
+\examples{
+
+str_to_id(" A string _ with Underscores ")
+
+}
+
diff --git a/no_build/index.R b/no_build/index.R
index bd1cc7f6..9598c0b4 100644
--- a/no_build/index.R
+++ b/no_build/index.R
@@ -1,5 +1,7 @@
#' ---
#' title: "highcharter: Just another Highcharts wrapper for R"
+#' author: Joshua Kunst
+#' date: false
#' output:
#' html_document:
#' theme: journal
@@ -250,7 +252,7 @@ hc %>%
hc_xAxis(title = list(text = "Month in x Axis"),
opposite = TRUE,
plotLines = list(
- list(label = list(text = "Mid year in a plotLine"),
+ list(label = list(text = "This is a plotLine"),
color = "#FF0000",
width = 2,
value = 5.5))) %>%
@@ -262,7 +264,7 @@ hc %>%
showLastLabel = FALSE,
plotBands = list(
list(from = 25, to = htmlwidgets::JS("Infinity"), color = "rgba(100, 0, 0, 0.1)",
- label = list(text = "So hot here in the plotBand"))))
+ label = list(text = "This is a plotBand"))))
##' ## hc_add_serie and hc_rm_serie ####
@@ -277,7 +279,6 @@ hc %>%
hc_add_serie(name = "London", data = citytemp$london, type = "area") %>%
hc_rm_serie(name = "New York")
-
##' ## hc_title, hc_subtitle, hc_credits and hc_legend, hc_tooltip, hc_exporting ####
#' Functions to modify the chart's main title, subtitle, credits, legend and tooltip.
@@ -296,7 +297,7 @@ hc %>%
layout = "vertical", x = 0, y = 100) %>%
hc_tooltip(crosshairs = TRUE, backgroundColor = "#FCFFC5",
shared = TRUE, borderWidth = 5) %>%
- hc_exporting(enabled = FALSE) # disable exporting option
+ hc_exporting(enabled = TRUE) # enable exporting option
##' # Shorcuts for add Data (data series) ####
@@ -592,18 +593,29 @@ highchart() %>%
nyears <- 5
df <- expand.grid(seq(12) - 1, seq(nyears) - 1)
-df$value <- seq(nrow(df)) + 10 * rnorm(nrow(df))
+df$value <- abs(seq(nrow(df)) + 10 * rnorm(nrow(df))) + 10
df$value <- round(df$value, 2)
ds <- setNames(list.parse2(df), NULL)
-highchart() %>%
+
+hc <- highchart() %>%
hc_chart(type = "heatmap") %>%
hc_title(text = "Simulated values by years and months") %>%
hc_xAxis(categories = month.abb) %>%
hc_yAxis(categories = 2016 - nyears + seq(nyears)) %>%
- hc_colorAxis(min = 0, minColor = "#FFFFFF", maxColor = "#434348") %>%
hc_add_serie(name = "value", data = ds)
+hc_colorAxis(hc, minColor = "#FFFFFF", maxColor = "#434348")
+
+require("viridisLite")
+
+n <- 4
+stops <- data_frame(q = 0:n/n,
+ c = substring(viridis(n + 1), 0, 7))
+stops <- list.parse2(stops)
+
+hc_colorAxis(hc, stops = stops, max = 75)
+
##' ## Treemap ####
data(diamonds, package = "ggplot2")