Skip to content
This repository was archived by the owner on Nov 2, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
7e7436c
Updates for automatic docs generation
hafen Oct 28, 2016
90f0be2
Update README
hafen Oct 28, 2016
2b269f4
Add latticeExtra to 'suggests'
hafen Oct 29, 2016
66d383b
Make rd lazy
hafen Oct 29, 2016
28237df
Update docs
hafen Oct 31, 2016
915d210
Update .travis.yml
hafen Oct 31, 2016
873a11e
Update .travis.yml
hafen Nov 1, 2016
4cbef46
Update .travis.yml
hafen Nov 1, 2016
18f3023
Update .travis.yml
hafen Nov 2, 2016
2e3da34
Update docs
hafen Nov 2, 2016
b7b7126
Update docs
hafen Nov 2, 2016
3e7e6de
Update docs
hafen Nov 3, 2016
89606ea
Work toward 0.12.5 compatibility
hafen May 2, 2017
3bf92e6
Update .lintr rules
hafen May 2, 2017
2dc1aea
Update title align parameter in theme_title - fixes #211
hafen May 2, 2017
f06a6c8
Update docs
hafen May 2, 2017
7ac09b4
Fix issue with excessive warnings under R 3.4.0
hafen May 2, 2017
20b6cc2
Fixes to work with v0.12.5
hafen Jun 7, 2017
428b93c
Update NEWS and bump version
hafen Jun 7, 2017
78e38a4
Merge
hafen Jun 7, 2017
98d7711
Update .Rbuildignore
hafen Sep 26, 2018
6d09db4
Docs updates
hafen Sep 26, 2018
c10d4f7
Update .Rbuildignore
hafen Sep 26, 2018
73ca35c
Update DESCRIPTION
hafen Oct 5, 2018
d90faed
Update ignore
hafen Oct 5, 2018
cdaf6bb
Update .travis.yml
hafen Nov 27, 2018
f5273f0
Update to use pkgdown
hafen May 26, 2020
8c3679b
Update to use pkgdown
hafen May 26, 2020
2c729be
Update README
hafen May 26, 2020
873eb98
Update .travis.yml
hafen May 26, 2020
43c7436
Update README
hafen May 26, 2020
39aec3f
Update docs and https
hafen May 26, 2020
5d39dae
Update README
hafen May 26, 2020
361c45c
Update docs
hafen May 26, 2020
8a04279
Update cran-comments
hafen May 26, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
12 changes: 12 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,15 @@ cran-comments.md
_gh-pages
.codecov.yml
vignettes2/
^js-scales
^.vscode
^docs-dev
inst/htmlwidgets/lib/bokehjs/notused
inst/htmlwidgets/lib/bokehjs/prev
^code-gen
^revdep$
rbokeh.code-workspace
^_pkgdown\.yml$
^docs$
^pkgdown$
^vignettes/rbokeh\.Rmd$
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ _ignore
inst/doc
_gh-pages
vignettes/index_cache/
revdep
1 change: 1 addition & 0 deletions .lintr
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
cache_directory: ".lintr_cache"
linters: with_defaults(
commented_code_linter = NULL,
absolute_paths_linter = NULL,
line_length_linter(100),
NULL
)
Expand Down
10 changes: 4 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
language: r
cache: packages

r_binary_packages:
- covr # code coverage check
- lintr # code lint
r:
- release

after_success:
- Rscript -e 'covr::codecov()'
- Rscript -e 'covr::codecov()'

branches:
only:
- master
- dev
- master
13 changes: 8 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
Package: rbokeh
Title: R Interface for Bokeh
Version: 0.5.0
Version: 0.5.1
Authors@R: c(
person("Ryan", "Hafen", email = "rhafen@gmail.com", role = c("aut", "cre")),
person("Kenton", "Russell", email = "kent.russell@timelyportfolio.com", role = "ctb"),
person("Jonathan", "Owen", email = "jonathanro@gmail.com", role = "ctb"),
person("Barret", "Schloerke", email = "schloerke@gmail.com", role = "ctb"),
person("Saptasrhi", "Guha", email = "saptarshi.guha@gmail.com", role = "ctb"),
person("Continuum Analytics, Inc.", role = c("aut", "cph"),
comment = "Bokeh library in htmlwidgets/lib, http://bokeh.pydata.org"
comment = "Bokeh library in htmlwidgets/lib, https://bokeh.pydata.org"
))
Description: A native R plotting library that provides a flexible declarative interface for creating interactive web-based graphics, backed by the Bokeh visualization library <http://bokeh.pydata.org/>.
Description: A native R plotting library that provides a flexible declarative interface for creating interactive web-based graphics, backed by the Bokeh visualization library <https://bokeh.pydata.org/>.
URL: https://hafen.github.io/rbokeh https://github.com/bokeh/rbokeh
BugReports: https://github.com/bokeh/rbokeh/issues
License: MIT + file LICENSE
Expand All @@ -35,7 +35,10 @@ Suggests:
lattice,
lintr,
roxygen2 (>= 5.0.0),
knitr
latticeExtra,
knitr,
rmarkdown
Enhances: shiny (>= 0.12)
RoxygenNote: 5.0.1
RoxygenNote: 7.1.0
Encoding: UTF-8
VignetteBuilder: knitr
2 changes: 1 addition & 1 deletion LICENSE.note
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The rbokeh package includes other open source software components. The following
is a list of these components (full copies of the license agreements used by
these components are included below):

- bokeh.js, http://bokeh.pydata.org/
- bokeh.js, https://bokeh.pydata.org/


bokeh.js license
Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@

Version 0.5
----------------------------------------------------------------------

- Fix issue with excessive warnings under R 3.4.0 (0.5.1)
- Update title `align` parameter in `theme_title()` (0.5.1)
- Fix issue with `gmap()` plots (0.5.1)
- Update to BokehJS 0.12.5 (0.5.1)
- Add spinner for long-loading figures
- Set default height/width if one or the other is specified
- Remove resize tool as default
Expand Down
2 changes: 1 addition & 1 deletion R/attr_mapping.R
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ valid_glyph <- function(dd) {
}

valid_color <- function(dd) {
all(dd %in% css_colors | (nchar(as.character(dd)) == 7 && grepl("^#", dd)))
all(dd %in% css_colors | (nchar(as.character(dd)) == 7 & grepl("^#", dd)))
}

valid_line <- function(dd) {
Expand Down
2 changes: 1 addition & 1 deletion R/constants.R
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ tableau_colors <- list(
"#F26C64", "#FFDD71", "#9FCD99")
)

# http://www.w3.org/TR/css3-color/#svg-color
# https://www.w3.org/TR/css3-color/#svg-color
css_colors <- c("aliceblue",
"antiquewhite", "aqua", "aquamarine", "azure", "beige", "bisque", "black",
"blanchedalmond", "blue", "blueviolet", "brown", "burlywood", "cadetblue",
Expand Down
2 changes: 1 addition & 1 deletion R/fig_axis.R
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ update_axis <- function(fig, position, label, grid = TRUE,
} else if (axis_type == "datetime") {
type_list <- list(format = "DatetimeTickFormatter",
tick = "DatetimeTicker", axis = "DatetimeAxis")
format_pars$formats <- format_pars$format
format_pars <- format_pars$format
format_pars$format <- NULL
format_pars <- handle_extra_pars(format_pars,
datetime_tick_formatter_map)
Expand Down
27 changes: 22 additions & 5 deletions R/fig_gmap.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## when rendering maybe use something
## like this to approximate zoom level
## for a given glyph_x_ranges and glyph_y_ranges
# http://stackoverflow.com/questions/6048975/google-maps-v3-how-to-calculate-the-zoom-level-for-a-given-bounds
# https://stackoverflow.com/questions/6048975/google-maps-v3-how-to-calculate-the-zoom-level-for-a-given-bounds

#' Initialize a Bokeh Google Map plot
#'
Expand Down Expand Up @@ -91,19 +91,36 @@ gmap <- function(lat = 0, lng = 0, zoom = 0, api_key = NULL,
fig$x$spec$model$plot$type <- "GMapPlot"
fig$x$spec$ref$type <- "GMapPlot"

fig$x$spec$model$plot$attributes$api_key <- api_key
fig$x$spec$model$plot$attributes$map_options <- list(
# {
# "attributes": {
# "lat": 30.29,
# "lng": -97.73,
# "zoom": 11
# },
# "id": "bec0c1da-f2f9-473c-bb7a-deb7da4c5340",
# "type": "GMapOptions"
# },

mopts <- list(
lat = lat,
lng = lng,
zoom = zoom,
map_type = map_type
)

if (!is.null(map_style)) {
fig$x$spec$model$plot$attributes$map_options$map_type <- NULL
fig$x$spec$model$plot$attributes$map_options$styles <- map_style
mopts$map_type <- NULL
mopts$styles <- map_style
}

mopts_id <- gen_id(fig, "GMapOptions")
moptsmod <- base_model_object("GMapOptions", mopts_id)
moptsmod$model$attributes <- mopts
fig$x$spec$model$gmapoptions <- moptsmod$model

fig$x$spec$model$plot$attributes$api_key <- api_key
fig$x$spec$model$plot$attributes$map_options <- moptsmod$ref

fig$x$spec$glyph_x_ranges[["dummy_map_layer"]] <- c(lng, lat)
fig$x$spec$glyph_y_ranges[["dummy_map_layer"]] <- c(lng, lat)
fig$x$spec$x_axis_type <- "numeric"
Expand Down
5 changes: 1 addition & 4 deletions R/fig_layer.R
Original file line number Diff line number Diff line change
Expand Up @@ -139,17 +139,14 @@ get_glyph_attrs <- function(spec, dat = NULL) {
if (!is.null(glyph_attrs$text))
glyph_attrs$text$field <- glyph_attrs$text$field$field

if (!is.null(glyph_attrs$visible))
glyph_attrs$visible <- glyph_attrs$visible$value

glyph_attrs
}

data_model <- function(dd, id = NULL) {
res <- base_model_object("ColumnDataSource", id)

res$model$attributes$column_names <- I(names(dd))
res$model$attributes$selected <- I(NULL)
res$model$attributes$selected <- list()
res$model$attributes$data <- as.list(dd)

res
Expand Down
22 changes: 20 additions & 2 deletions R/fig_legend.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,36 @@ add_legend <- function(fig, legends, extra_pars) {
leg_id <- gen_id(fig, "legend")
leg_name <- "legend"

leg <- legend_model(leg_id, fig$x$spec$ref, legends, extra_pars)
items <- list()
for (ii in seq_along(legends)) {
lg <- legends[[ii]]
li_id <- gen_id(fig, paste0("legenditem", ii))
li_name <- paste0("legenditem_", ii)
lgmod <- legend_item_model(li_id, lg)
fig$x$spec$model[[li_name]] <- lgmod$model
items[[ii]] <- lgmod$ref
}

leg <- legend_model(leg_id, fig$x$spec$ref, items, extra_pars)

fig$x$spec$model$plot$attributes$renderers[[leg_id]] <- leg$ref
fig$x$spec$model[[leg_name]] <- leg$model

fig
}

legend_item_model <- function(id, item) {
res <- base_model_object("LegendItem", id)
res$model$attributes$label <- list(value = item[[1]])
res$model$attributes$renderers <- item[[2]]

res
}

legend_model <- function(id, plot_ref, legends, extra_pars) {
res <- base_model_object("Legend", id)
res$model$attributes$plot <- plot_ref
res$model$attributes$legends <- legends
res$model$attributes$items <- legends

res$model$attributes <- c(res$model$attributes, extra_pars)

Expand Down
19 changes: 10 additions & 9 deletions R/fig_tool.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# http://bokeh.pydata.org/en/latest/docs/reference/models.html
# https://bokeh.pydata.org/en/latest/docs/reference/models.html

#' Add "pan" tool to a Bokeh figure
#' @param dimensions a vector specifying whether the pan tool should pan with respect to the x axis ("width") and the y axis ("height") or both (c("width", "height"))
#' @param dimensions a vector specifying whether the pan tool should pan with respect to the x axis ("width") and the y axis ("height") or "both"
#' @template tools
#' @examples
#' \donttest{
Expand All @@ -10,12 +10,13 @@
#' tool_pan(dimensions = "height")
#' }
#' @export
tool_pan <- function(fig, dimensions = c("width", "height")) {
update_tool(fig, which = "pan", args = list(dimensions = dimensions, plot_ref = fig$x$spec$ref))
tool_pan <- function(fig, dimensions = "both") {
update_tool(fig, which = "pan", args = list(dimensions = jsonlite::unbox(dimensions),
plot_ref = fig$x$spec$ref))
}

#' Add "wheel_zoom" tool to a Bokeh figure
#' @param dimensions a vector specifying whether the wheel_zoom tool should zoom with respect to the x axis ("width") and the y axis ("height") or both (c("width", "height"))
#' @param dimensions a vector specifying whether the wheel_zoom tool should zoom with respect to the x axis ("width") and the y axis ("height") or "both"
#' @template tools
#' @examples
#' \donttest{
Expand All @@ -24,9 +25,9 @@ tool_pan <- function(fig, dimensions = c("width", "height")) {
#' tool_wheel_zoom(dimensions = "height")
#' }
#' @export
tool_wheel_zoom <- function(fig, dimensions = c("width", "height")) {
tool_wheel_zoom <- function(fig, dimensions = "both") {
update_tool(fig, which = "wheel_zoom",
args = list(dimensions = dimensions, plot_ref = fig$x$spec$ref))
args = list(dimensions = jsonlite::unbox(dimensions), plot_ref = fig$x$spec$ref))
}

#' Add "save" tool to a Bokeh figure
Expand Down Expand Up @@ -229,7 +230,7 @@ tool_box_zoom <- function(fig,
overlay = ba_model$ref))
}

tool_help <- function(fig, redirect = "http://hafen.github.io/rbokeh",
tool_help <- function(fig, redirect = "https://hafen.github.io/rbokeh",
help_tooltip = "Click to learn more about rbokeh.") {
update_tool(fig, which = "help",
args = list(plot_ref = fig$x$spec$ref, redirect = redirect,
Expand Down Expand Up @@ -282,7 +283,7 @@ tool_model <- function(id, tool_name, plot_ref, ...) {

tool_events <- function(id) {
res <- base_model_object("ToolEvents", id)
res$model$geometries <- I(NULL)
res$model$geometries <- list()
res
}

Expand Down
6 changes: 3 additions & 3 deletions R/json_helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ underscore2camel <- function(x) {
# 'var model = Bokeh.Collections(modeltype).get(modelid);\n',
# 'var view = new model.default_view({model: model, el: \'#', elementid, '\'});\n',
# 'Bokeh.index[modelid] = view;\n'),
# css_external = paste0("http://cdn.pydata.org/bokeh/release/bokeh-", ver, ".min.css"),
# js_external = paste0("http://cdn.pydata.org/bokeh/release/bokeh-", ver, ".min.js")
# css_external = paste0("https://cdn.pydata.org/bokeh/release/bokeh-", ver, ".min.css"),
# js_external = paste0("https://cdn.pydata.org/bokeh/release/bokeh-", ver, ".min.js")
# )
# library(httr)
# a <- POST("http://codepen.io/pen/define/", body = list(data = data), encode = "json")
# a <- POST("https://codepen.io/pen/define/", body = list(data = data), encode = "json")
# }
3 changes: 1 addition & 2 deletions R/layer_bar.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ly_bar <- function(
color = NULL, alpha = 1,
position = c("stack", "fill", "dodge"), width = 0.9, hover = FALSE,
origin = NULL, breaks = NULL, right = FALSE, binwidth = NULL,
lname = NULL, lgroup = NULL, legend = NULL, visible = TRUE, ...
lname = NULL, lgroup = NULL, legend = NULL, ...
) {

position <- match.arg(position)
Expand All @@ -47,7 +47,6 @@ ly_bar <- function(
legend,
lname,
lgroup,
visible,
dots = lazy_dots(...)
)
)
Expand Down
12 changes: 4 additions & 8 deletions R/layer_glyphs.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ ly_annular_wedge <- function(
start_angle = 0, end_angle = 2 * pi, direction = "anticlock",
color = NULL, alpha = 1,
hover = NULL, url = NULL, legend = NULL,
lname = NULL, lgroup = NULL, visible = TRUE, ...
lname = NULL, lgroup = NULL, ...
) {

validate_fig(fig, "ly_annular_wedge")
Expand All @@ -52,7 +52,6 @@ ly_annular_wedge <- function(
legend,
lname,
lgroup,
visible,
dots = lazy_dots(...)
)
)
Expand Down Expand Up @@ -108,7 +107,7 @@ ly_annulus <- function(
inner_radius = 0.1, outer_radius = 0.2,
color = NULL, alpha = 1,
hover = NULL, url = NULL, legend = NULL,
lname = NULL, lgroup = NULL, visible = TRUE,
lname = NULL, lgroup = NULL,
...
) {

Expand All @@ -127,7 +126,6 @@ ly_annulus <- function(
legend,
lname,
lgroup,
visible,
dots = lazy_dots(...)
)
)
Expand Down Expand Up @@ -183,7 +181,7 @@ ly_arc <- function(
color = NULL, alpha = 1, width = 2, type = 1,
radius = 0.2,
start_angle = 0, end_angle = 2 * pi, direction = "anticlock",
legend = NULL, lname = NULL, lgroup = NULL, visible = TRUE,
legend = NULL, lname = NULL, lgroup = NULL,
...
) {

Expand All @@ -206,7 +204,6 @@ ly_arc <- function(
legend,
lname,
lgroup,
visible,
dots = lazy_dots(...)
)
)
Expand Down Expand Up @@ -260,7 +257,7 @@ ly_wedge <- function(
radius = 0.3, start_angle = 0, end_angle = 2 * pi, direction = "anticlock",
color = NULL, alpha = 1,
hover = NULL, url = NULL, legend = NULL,
lname = NULL, lgroup = NULL, visible = TRUE,
lname = NULL, lgroup = NULL,
...
) {

Expand All @@ -281,7 +278,6 @@ ly_wedge <- function(
legend,
lname,
lgroup,
visible,
dots = lazy_dots(...)
)
)
Expand Down
Loading