Skip to content

Commit

Permalink
starting 0.2.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
jbkunst committed Feb 25, 2016
1 parent e1ee4a3 commit 17d04f3
Show file tree
Hide file tree
Showing 19 changed files with 473 additions and 395 deletions.
2 changes: 0 additions & 2 deletions .Rbuildignore
Expand Up @@ -4,6 +4,4 @@
tests/
no_build/
^\.travis\.yml$
^NEWS$
^NEWS\.md$
fort.6
4 changes: 2 additions & 2 deletions DESCRIPTION
@@ -1,12 +1,12 @@
Package: highcharter
Version: 0.1.0.9000
Version: 0.2.0
Type: Package
Title: A Wrapper for the 'Highcharts' Library
Description: A wrapper for the 'Highcharts' library including
shortcut functions to plot R objects. 'Highcharts'
<http://www.highcharts.com/> is a charting library offering
numerous chart types with a simple configuration syntax.
Date: 2016-01-12
Date: 2016-02-25
Author: Joshua Kunst <jbkunst@gmail.com>
Maintainer: Joshua Kunst <jbkunst@gmail.com>
License: MIT + file LICENSE
Expand Down
3 changes: 3 additions & 0 deletions NAMESPACE
Expand Up @@ -96,6 +96,7 @@ importFrom(dplyr,select)
importFrom(dplyr,select_)
importFrom(dplyr,tbl_df)
importFrom(grDevices,colorRampPalette)
importFrom(graphics,hist)
importFrom(htmlwidgets,JS)
importFrom(htmlwidgets,createWidget)
importFrom(htmlwidgets,shinyRenderWidget)
Expand All @@ -110,13 +111,15 @@ importFrom(rlist,list.merge)
importFrom(rlist,list.parse)
importFrom(stats,ecdf)
importFrom(stats,is.ts)
importFrom(stats,qnorm)
importFrom(stats,time)
importFrom(stringr,str_extract)
importFrom(stringr,str_replace)
importFrom(stringr,str_replace_all)
importFrom(stringr,str_to_lower)
importFrom(stringr,str_trim)
importFrom(tidyr,gather)
importFrom(utils,tail)
importFrom(viridisLite,viridis)
importFrom(xts,is.xts)
importFrom(zoo,as.Date)
29 changes: 28 additions & 1 deletion NEWS.md
@@ -1,4 +1,31 @@
# highcharter 0.1
# highcharter 0.2.0

* Implemenation of highcharts with boost module `highchart2()` (#43).
This include highcharts.js, exporting.js and boost-module.js.

* Highstock implementation/support (#10)

* Highmaps implementation/support (#25)

* Adding themes (#35): 538, economis, dotabuff, google, theme null (#19)

* Plugins: Add font awesome integration (#45), fill-pattern (#31),
draggable-points (#28)

* New `hchart` function. Generic function to chart acf, forecast,
ts, stl, xts, ohcl objects (#2) (#27)

* In highmaps prevent scrolling when cursor is over the map (#38)

* Import rex-export %>% (#15)

* Heigth scale in the container in rstudio IDE (#14)

* Avoid duplicate css calls (#6)

* Add uscountygeojson, usgeojson, worldgeojson, unemployment data

# highcharter 0.1.0

* Data: city temp. favorite bars, favorite pies.

Expand Down
6 changes: 4 additions & 2 deletions R/api-hc-extras.R
Expand Up @@ -216,7 +216,7 @@ hc_mapNavigation <- function(hc, ...) {
#'
#'
#' @param hc A \code{highchart} \code{htmlwidget} object.
#' @param ... Arguments defined in \url{https://github.com/highcharts/pattern-fillhc}.
#' @param ... Arguments defined in \url{http://www.highcharts.com/plugin-registry/single/9/Pattern-Fill}.
#'
#' @export
hc_defs <- function(hc, ...) {
Expand All @@ -234,5 +234,7 @@ hc_defs <- function(hc, ...) {
#'
#' @export
hc_annotations <- function(hc, ...) {
highcharter:::.hc_opt(hc, "annotations", ...)

.hc_opt(hc, "annotations", ...)

}
13 changes: 13 additions & 0 deletions R/data-usgeojson.R
@@ -0,0 +1,13 @@
#' US States map in Geojson format (list)
#'
#' This data comes from the \url{https://code.highcharts.com/mapdata/countries/us/us-all.js}
#' and is used in highmaps examples.
#'
#' @docType data
#' @name usgeojson
#' @usage usgeojson
#' @format A \code{list} in geojson format.
#' @examples
#' data(usgeojson)
#' usgeojson
NULL
36 changes: 21 additions & 15 deletions R/hchart.R
Expand Up @@ -23,6 +23,7 @@ hchart.default <- function(object, ...) {
" are not supported by hchart (yet).", call. = FALSE)
}

#' @importFrom graphics hist
#' @export
hchart.numeric <- function(object, breaks = "FD", ...) {

Expand Down Expand Up @@ -109,6 +110,7 @@ hchart.forecast <- function(object, fillOpacity = 0.3, ...){

}

#' @importFrom stats qnorm
#' @export
hchart.acf <- function(object, ...){

Expand Down Expand Up @@ -161,7 +163,7 @@ hchart.mts <- function(object, ...) {
}

#' @export
hchart.stl <- function(object, widths = c(2, 1, 1, 1), sep = 0.01) {
hchart.stl <- function(object, ..., widths = c(2, 1, 1, 1), sep = 0.01) {

tss <- object$time.series
ncomp <- ncol(tss)
Expand Down Expand Up @@ -205,6 +207,8 @@ hchart.dist <- function(object, ...) {

df <- as.data.frame(as.matrix(object), stringsAsFactors = FALSE)

dist <- NULL

x <- y <- names(df)

df <- tbl_df(cbind(x = y, df)) %>%
Expand Down Expand Up @@ -238,27 +242,29 @@ hchart.dist <- function(object, ...) {
hc_colorAxis(arg = "")
}

# #' @importFrom seasonal original final trend outlier
# #' @export
# hchart.seas <- function(object, outliers = TRUE, trend = FALSE, ...) {
#
# hc <- highchart() %>%
# hc_add_serie_ts(original(object), name = "original", zIndex = 3, id = "original") %>%
# hc_add_serie_ts(final(object), name = "adjusted", zIndex = 2, id = "adjusted")
#
# # @export
# hchart.seas <- function(object, ..., outliers = TRUE, trend = FALSE) {
#
# hc <- highchart() %>%
# hc_add_serie_ts(seasonal::original(object),
# name = "original",
# zIndex = 3, id = "original") %>%
# hc_add_serie_ts(seasonal::final(object),
# name = "adjusted",
# zIndex = 2, id = "adjusted")
#
# if (trend) {
# hc <- hc %>% hc_add_serie_ts(trend(object), name = "trend", zIndex = 1)
# hc <- hc %>% hc_add_serie_ts(seasonal::trend(object), name = "trend", zIndex = 1)
# }
#
#
# if (outliers) {
# ol.ts <- outlier(object)
# ol.ts <- seasonal::outlier(object)
# ixd.nna <- !is.na(ol.ts)
# text <- as.character(ol.ts)[!is.na(ol.ts)]
# dates <- zoo::as.Date(time(ol.ts))[!is.na(ol.ts)]
# hc <- hc %>% hc_add_series_flags(dates, text, text, zIndex = 4,
# name = "outiliers", id = "adjusted")
# name = "outiliers", id = "adjusted")
# }
#
#
# hc
#
# }
32 changes: 31 additions & 1 deletion R/shortcuts.R
Expand Up @@ -174,7 +174,7 @@ hc_add_serie_labels_values <- hc_add_series_labels_values
#' (\url{http://api.highcharts.com/highcharts#series}).
#'
#' @examples
#'
#'
#' \dontrun{
#'
#' library("treemap")
Expand Down Expand Up @@ -269,6 +269,33 @@ hc_add_serie_treemap <- hc_add_series_treemap
#'
#' @examples
#'
#' library("dplyr")
#' library("viridisLite")
#'
#' data("USArrests", package = "datasets")
#' data("usgeojson")
#'
#' USArrests <- USArrests %>%
#' mutate(state = rownames(.))
#'
#' n <- 4
#' colstops <- data.frame(q = 0:n/n,
#' c = substring(viridis(n + 1, option = "A"), 0, 7)) %>%
#' list.parse2()
#'
#' highchart() %>%
#' hc_title(text = "Violent Crime Rates by US State") %>%
#' hc_subtitle(text = "Source: USArrests data") %>%
#' hc_add_series_map(usgeojson, USArrests, name = "Murder arrests (per 100,000)",
#' value = "Murder", joinBy = c("woename", "state"),
#' dataLabels = list(enabled = TRUE,
#' format = '{point.properties.postalcode}')) %>%
#' hc_colorAxis(stops = colstops) %>%
#' hc_legend(valueDecimals = 0, valueSuffix = "%") %>%
#' hc_mapNavigation(enabled = TRUE)
#'
#' \dontrun{
#'
#' library("viridisLite")
#' library("dplyr")
#' data(unemployment)
Expand All @@ -289,6 +316,9 @@ hc_add_serie_treemap <- hc_add_series_treemap
#' valueSuffix = "%") %>%
#' hc_mapNavigation(enabled = TRUE)
#'
#' }
#'
#' @importFrom utils tail
#' @export
hc_add_series_map <- function(hc, map, df, value, joinBy, ...) {

Expand Down
10 changes: 4 additions & 6 deletions cran-comments.md
@@ -1,9 +1,7 @@
## Resubmission
## Resubmitting new version 0.2.0

This is a resubmission. In this version I fix/have:
Adding imports: hist, qnomr, tail

* More dateiled descriptions in manual pages.
* Adding examples for every exported function (whithout \dontrun).
* Adding "<>" to link highcharts.com in the description.
Modify examples which take too long

Thanks. Regards,
thanks a lot again!
Binary file added data/usgeojson.rda
Binary file not shown.
29 changes: 29 additions & 0 deletions man/hc_add_series_map.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/hc_add_series_treemap.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/hc_defs.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions man/usgeojson.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions no_build/data.R
Expand Up @@ -91,6 +91,36 @@ counties

save(uscountygeojson, file = "data/uscountygeojson.rda", compress = "xz")

#### usgeojson all all ####
url <- "https://code.highcharts.com/mapdata/countries/us/us-all.js"
tmpfile <- tempfile(fileext = ".json")
download.file(url, tmpfile)
usgeojson <- readLines(tmpfile)
usgeojson <- gsub(".* = ", "", usgeojson)
usgeojson <- jsonlite::fromJSON(usgeojson, simplifyVector = FALSE)

usgeojson$features[52] <- NULL

usgeojson$features <- map(usgeojson$features, function(x){
# x <- uscountygeojson$features[[10]]
x$properties$code <- x$properties$`hc-key`
x$properties <- x$properties[!grepl("hc", names(x$properties))]
names(x$properties) <- gsub("-", "", names(x$properties))
names(x$properties) <- gsub("isoa", "iso", names(x$properties))
x$properties$name <- ifelse(x$properties$code == "us-nm-013", "Dona Ana", x$properties$name)
x
})

states <- map_df(usgeojson$features, function(x){
as.data.frame(x$properties, stringsAsFactors = FALSE)
})

states

save(usgeojson, file = "data/usgeojson.rda", compress = "xz")



#### fontawesome ####
library("stringr")
library("dplyr")
Expand Down
22 changes: 22 additions & 0 deletions no_build/get-issues.R
@@ -0,0 +1,22 @@
rm(list = ls())
library("dplyr")
library("purrr")
library("httr")

issues <- GET("https://api.github.com/repos/jbkunst/highcharter/issues",
query = list(state = "closed", milestone = 1)) %>%
content()

names(issues)

jsonview::json_tree_view(issues)

dfissues <- map_df(issues, function(x){
data_frame(
x$title,
x$number,
substr(x$body, 0, 100)
)
})

dfissues

0 comments on commit 17d04f3

Please sign in to comment.