Skip to content

Commit

Permalink
docs for transitions - close #56
Browse files Browse the repository at this point in the history
  • Loading branch information
SymbolixAU committed Dec 1, 2018
1 parent bf46840 commit ebbdbf8
Show file tree
Hide file tree
Showing 29 changed files with 297 additions and 62 deletions.
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Encoding: UTF-8
LazyData: true
Depends: R (>= 3.3.0)
Imports:
geojsonsf,
googlePolylines (>= 0.7.2),
htmlwidgets,
htmltools,
Expand Down
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# mapdeck 0.2

* `transitions` argument for most layers
* `mapdeck()` argument order changed so `data` is first ( to work better with pipes )
* `update_view` and `focus_layer` added to focus layers on data
* bearing and pitch maintained on data layer updates
Expand Down
35 changes: 23 additions & 12 deletions R/map_layer_arc.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,36 +19,31 @@ mapdeckArcDependency <- function() {
#' @param layer_id single value specifying an id for the layer. Use this value to
#' distinguish between shape layers of the same type. Layers with the same id are likely
#' to conflict and not plot correctly
#' @param origin vector of longitude and latitude columns, or an \code{sfc} column.
#' transition enabled
#' @param destination vector of longitude and latitude columns, or an \code{sfc} column.
#' transition enabled
#' @param origin vector of longitude and latitude columns, or an \code{sfc} column
#' @param destination vector of longitude and latitude columns, or an \code{sfc} column
#' @param id an id value in \code{data} to identify layers when interacting in Shiny apps.
#' @param stroke_from variable or hex colour to use as the staring stroke colour.
#' transition enabled
#' @param stroke_from variable or hex colour to use as the staring stroke colour
#' @param stroke_from_opacity Either a string specifying the
#' column of \code{data} containing the stroke opacity of each shape, or a value
#' between 1 and 255 to be applied to all the shapes
#' @param stroke_to variable or hex colour to use as the ending stroke colour.
#' transition enabled
#' @param stroke_to variable or hex colour to use as the ending stroke colour
#' @param stroke_to_opacity Either a string specifying the
#' column of \code{data} containing the stroke opacity of each shape, or a value
#' between 1 and 255 to be applied to all the shapes
#' @param stroke_width width of the stroke. transition enabled
#' @param stroke_width width of the stroke
#' @param tooltip variable of \code{data} containing text or HTML to render as a tooltip
#' @param auto_highlight logical indicating if the shape under the mouse should auto-highlight
#' @param highlight_colour hex string colour to use for highlighting. Must contain the alpha component.
#' @param digits integer. Use this parameter to specify how many digits (decimal places)
#' should be used for the latitude / longitude coordinates.
#' @param palette string or matrix. String is either one of "viridis","inferno",
#' "magma","plasma" or "cividis". A matrix is a 3 or 4 column numeric matrix of values
#' between [0, 255], where the 4th column represents the alpha.
#' @param na_colour hex string colour to use for NA values
#' @param legend either a logical indiciating if the legend(s) should be displayed, or
#' a named list indicating which colour attributes should be included in the legend.
#' @param legend_options A list of options for controlling the legend.
#' @param update_view logical indicating if the map should update the bounds to include this layer
#' @param focus_layer logical indicating if the map should update the bounds to only include this layer
#' @param transitions
#' @param transitions list specifying the duration of transitions.
#'
#' @section id:
#'
Expand All @@ -71,6 +66,22 @@ mapdeckArcDependency <- function() {
#'
#' If the layer allows different fill and stroke colours, you can use different options for each. See examples in \link{add_arc}.
#'
#' @section transitions:
#'
#' The transitions argument lets you specify the time it will take for the shapes to transition
#' from one state to the next. Only works in an interactive environment (Shiny).
#' The time is in milliseconds
#'
#' Available transitions for arc
#'
#' list(
#' origin = 0,
#' destination = 0,
#' stroke_from = 0,
#' stroke_to = 0,
#' stroke_width = 0
#' )
#'
#' @examples
#' \donttest{
#'
Expand Down
18 changes: 17 additions & 1 deletion R/map_layer_geojson.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,22 @@ mapdeckGeojsonDependency <- function() {
#' @param tooltip variable of \code{data} containing text or HTML to render as a tooltip.
#' Only works on \code{sf} objects.
#'
#' @details
#'
#' @section transitions:
#'
#' The transitions argument lets you specify the time it will take for the shapes to transition
#' from one state to the next. Only works in an interactive environment (Shiny).
#' The time is in milliseconds
#'
#' Available transitions for geojson
#'
#' list(
#' fill_colour = 0,
#' stroke_colour = 0,
#' stroke_width = 0,
#' elevation = 0,
#' radius = 0
#' )
#'
#' @section Raw Geojson:
#'
Expand Down Expand Up @@ -140,6 +155,7 @@ mapdeckGeojsonDependency <- function() {
#' )
#'
#' ## putting elevation and width values onto raw GeoJSON
#' library(geojsonsf)
#' sf <- geojsonsf::geojson_sf( geojson )
#' sf$width <- sample(1:100, size = nrow(sf), replace = TRUE)
#' sf$elevation <- sample(100:1000, size = nrow(sf), replace = T)
Expand Down
9 changes: 0 additions & 9 deletions R/map_layer_grid.R
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,6 @@ add_grid <- function(
focus_layer = FALSE
) {

# l <- as.list( match.call( expand.dots = F) )
# l[[1]] <- NULL
# l[["data"]] <- NULL
# l[["map"]] <- NULL
# l[["elevation_scale"]] <- NULL
# l[["cell_size"]] <- NULL
# l[["colour_range"]] <- NULL
# l[["auto_highlight"]] <- NULL
# l[["layer_id"]] <- NULL
l <- list()
l[["lon"]] <- force(lon)
l[["lat"]] <- force(lat)
Expand Down
10 changes: 1 addition & 9 deletions R/map_layer_hexagon.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ mapdeckHexagonDependency <- function() {
#' @inheritParams add_arc
#' @param lon column containing longitude values
#' @param lat column containing latitude values
#' @param polyline column of \code{data} containing the polylines
#' @param radius in metres
#' @param elevation_scale value to sacle the elevations of the hexagons
#' @param colour_range palette of colours
Expand Down Expand Up @@ -79,15 +80,6 @@ add_hexagon <- function(
focus_layer = FALSE
) {

# l <- as.list( match.call( expand.dots = F) )
# l[[1]] <- NULL
# l[["data"]] <- NULL
# l[["map"]] <- NULL
# l[["auto_highlight"]] <- NULL
# l[["light_settings"]] <- NULL
# l[["layer_id"]] <- NULL
# l[["colour_range"]] <- NULL

l <- list()
l[["polyline"]] <- force(polyline)
l[["lon"]] <- force(lon)
Expand Down
15 changes: 15 additions & 0 deletions R/map_layer_line.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,21 @@ mapdeckLineDependency <- function() {
#' @inheritSection add_arc legend
#' @inheritSection add_arc id
#'
#' @section transitions:
#'
#' The transitions argument lets you specify the time it will take for the shapes to transition
#' from one state to the next. Only works in an interactive environment (Shiny).
#' The time is in milliseconds
#'
#' Available transitions for line
#'
#' list(
#' origin = 0,
#' destination = 0,
#' stroke_colour = 0,
#' stroke_width = 0
#' )
#'
#' @examples
#' \donttest{
#'
Expand Down
15 changes: 15 additions & 0 deletions R/map_layer_path.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,21 @@ mapdeckPathDependency <- function() {
#' @inheritSection add_arc legend
#' @inheritSection add_arc id
#'
#' @section transitions:
#'
#' The transitions argument lets you specify the time it will take for the shapes to transition
#' from one state to the next. Only works in an interactive environment (Shiny).
#' The time is in milliseconds
#'
#' Available transitions for path
#'
#' list(
#' path = 0,
#' stroke_colour = 0,
#' stroke_width = 0
#' )
#'
#'
#' @examples
#' \donttest{
#'
Expand Down
13 changes: 13 additions & 0 deletions R/map_layer_pointcloud.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,19 @@ mapdeckPointcloudDependency <- function() {
#' @inheritSection add_arc legend
#' @inheritSection add_arc id
#'
#' @section transitions:
#'
#' The transitions argument lets you specify the time it will take for the shapes to transition
#' from one state to the next. Only works in an interactive environment (Shiny).
#' The time is in milliseconds
#'
#' Available transitions for pointcloud
#'
#' list(
#' position = 0,
#' fill_colour = 0
#' )
#'
#' @examples
#' \donttest{
#' ## You need a valid access token from Mapbox
Expand Down
18 changes: 17 additions & 1 deletion R/map_layer_polygon.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,22 @@ mapdeckPolygonDependency <- function() {
#' @inheritSection add_arc legend
#' @inheritSection add_arc id
#'
#' @section transitions:
#'
#' The transitions argument lets you specify the time it will take for the shapes to transition
#' from one state to the next. Only works in an interactive environment (Shiny).
#' The time is in milliseconds
#'
#' Available transitions for polygon
#'
#' list(
#' polygon = 0,
#' fill_colour = 0,
#' stroke_colour = 0,
#' stroke_width = 0,
#' elevation = 0
#' )
#'
#' @examples
#' \donttest{
#'
Expand Down Expand Up @@ -63,7 +79,7 @@ mapdeckPolygonDependency <- function() {
#' library(sf)
#' library(geojsonsf)
#'
#' sf <- geojson_sf("https://symbolixau.github.io/data/geojson/SA2_2016_VIC.json")
#' sf <- geojsonsf::geojson_sf("https://symbolixau.github.io/data/geojson/SA2_2016_VIC.json")
#'
#' mapdeck(
#' token = key
Expand Down
17 changes: 15 additions & 2 deletions R/map_layer_scatterplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,31 @@ mapdeckScatterplotDependency <- function() {
#' @param palette string or matrix. String is either one of "viridis","inferno",
#' "magma","plasma" or "cividis". A matrix is a 3 or 4 column numeric matrix of values
#' between [0, 255], where the 4th column represents the alpha.
#' @param na_colour hex string colour to use for NA values
#'
#' @inheritSection add_arc legend
#' @inheritSection add_arc id
#'
#' @section transitions:
#'
#' The transitions argument lets you specify the time it will take for the shapes to transition
#' from one state to the next. Only works in an interactive environment (Shiny).
#' The time is in milliseconds
#'
#' Available transitions for scatterplot
#'
#' list(
#' position = 0,
#' fill_colour = 0,
#' radius = 0
#' )
#'
#' @examples
#'
#' \donttest{
#' ## You need a valid access token from Mapbox
#' key <- 'abc'
#'
#' mapdeck( token = key, style = style = mapdeck_style("dark"), pitch = 45 ) %>%
#' mapdeck( token = key, style = mapdeck_style("dark"), pitch = 45 ) %>%
#' add_scatterplot(
#' data = capitals
#' , lat = "lat"
Expand Down
15 changes: 15 additions & 0 deletions R/map_layer_text.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,21 @@ mapdeckTextDependency <- function() {
#' @inheritSection add_arc legend
#' @inheritSection add_arc id
#'
#' @section transitions:
#'
#' The transitions argument lets you specify the time it will take for the shapes to transition
#' from one state to the next. Only works in an interactive environment (Shiny).
#' The time is in milliseconds
#'
#' Available transitions for text
#'
#' list(
#' position = 0,
#' fill_colour = 0,
#' angle = 0,
#' size = 0
#' )
#'
#' @examples
#'
#' \donttest{
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
39 changes: 26 additions & 13 deletions man/add_arc.Rd

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

Loading

0 comments on commit ebbdbf8

Please sign in to comment.