Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge dev into master #282

Merged
merged 75 commits into from
Nov 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
e5b0cfe
contribute test script
Aug 3, 2020
a242d49
remove version updating in DESCRIPTION
Aug 3, 2020
f1b81d6
fix EOL
rpkyle Aug 4, 2020
4d234cb
Merge pull request #222 from plotly/212-untangle-dashr-build
rpkyle Aug 4, 2020
4e4ccb1
Add support for user-defined server routes (#225)
rpkyle Aug 28, 2020
5bd1bbb
Provide support for script and stylesheet attributes (#226)
rpkyle Sep 4, 2020
3f862f9
Authenticate on pulls from Docker Hub (#231)
rpkyle Oct 6, 2020
3a3ee2f
Add support for callback graph improvements and timing (#224)
rpkyle Oct 9, 2020
766e3a8
Update CHANGELOG.md
rpkyle Oct 12, 2020
3b54773
189 - Add Pattern Matching Callbacks for Dash R (#228)
HammadTheOne Oct 21, 2020
03ed383
Fixing Null error with glue::glue interpolation (#233)
HammadTheOne Oct 21, 2020
5b31534
Update CHANGELOG.md
rpkyle Oct 26, 2020
2fdd157
Update dash-renderer to v1.8.2 (#234)
rpkyle Oct 26, 2020
bb9fc6a
bump package version to v0.8.0
Oct 26, 2020
314ced8
Update R/dash.R
rpkyle Oct 27, 2020
3f9f9f1
Update tests/testthat/test-wildcards.R
rpkyle Oct 27, 2020
e093463
Update DESCRIPTION
rpkyle Oct 27, 2020
6ee2702
Merge branch 'master' into dev
rpkyle Oct 27, 2020
b477fe0
add PMC example
Oct 27, 2020
6fffb44
update documentation
Oct 27, 2020
b4ca5f9
update CHANGELOG release date
Oct 27, 2020
24b491a
Merge branch 'dev' of github.com:plotly/dashR into dev
Oct 27, 2020
c120ab2
:hammer: PMC docs refactor
Oct 27, 2020
56d1dc0
Update tests/integration/callbacks/test_pattern_matching.py
rpkyle Oct 27, 2020
226f949
Update tests/integration/callbacks/test_pattern_matching.py
rpkyle Oct 27, 2020
fd5f3da
Update tests/integration/callbacks/test_pattern_matching.py
rpkyle Oct 28, 2020
c3a34b6
add import of glue
Oct 28, 2020
877f463
add glue to imports.R
Oct 28, 2020
b238a57
fix line length issue
Oct 28, 2020
ff858ac
Fix setCallbackContext for wildcard and ordinary inputs (#237)
HammadTheOne Oct 30, 2020
7a23405
Merge branch 'master' into dev
rpkyle Oct 31, 2020
aac1db5
bump dependency versions
Oct 31, 2020
b7b1cfa
update CHANGELOG
Oct 31, 2020
4326e08
update dash-renderer to v1.8.3
Oct 31, 2020
ed022c8
update CHANGELOG
Oct 31, 2020
8c2dc66
Favicon fix (#240)
HammadTheOne Nov 17, 2020
d5a472e
Remove context reference from CircleCI (#241)
rpkyle Jan 19, 2021
0aec5f8
Dash R Core Package Unification (#243)
HammadTheOne May 18, 2021
54c9695
Added deprecation warning if dcc, html, or table packages are attache…
HammadTheOne May 20, 2021
a055015
Update `highlight.js` dependency for dash-table (#262)
HammadTheOne Aug 11, 2021
043c9ee
Add Dash 2 layout syntax wrappers and html tags (#265)
HammadTheOne Aug 25, 2021
456f09d
Fix suppress_callback_exceptions config (#268)
HammadTheOne Sep 22, 2021
948f0f7
Simplified callback syntax and addtional utility functions (#270)
HammadTheOne Sep 29, 2021
ed1acb3
Update monorepo and rebuild package (#271)
HammadTheOne Oct 3, 2021
4419ce3
Merge branch 'master' into dev
HammadTheOne Oct 4, 2021
0b3544b
Updating DESCRIPTION and .Rbuildignore forchecks
HammadTheOne Oct 4, 2021
89f74ef
Updating function descriptions and NAMESPACE imports
HammadTheOne Oct 4, 2021
5dda6f5
Fixed examples and updated docs
HammadTheOne Oct 5, 2021
7c76953
Updating version
HammadTheOne Oct 6, 2021
d419517
Remove references to dash namespace within package
HammadTheOne Oct 7, 2021
aff9b99
Update testthat and remove deprecated context calls
HammadTheOne Oct 7, 2021
0ad3b24
Removed fixup_metadata.R
HammadTheOne Oct 7, 2021
3aa7abd
Removing more dash namespace references
HammadTheOne Oct 8, 2021
e934ca0
Concatenating component function files
HammadTheOne Oct 8, 2021
68427b3
Updating checks
HammadTheOne Oct 8, 2021
cb93cdb
Merging components into package R files
HammadTheOne Oct 8, 2021
3b440da
Fixing check
HammadTheOne Oct 9, 2021
318d7cf
More package cleanup
HammadTheOne Oct 9, 2021
6a1886a
testthat 3.0.0
HammadTheOne Oct 9, 2021
950b90d
Rebuilding package
HammadTheOne Oct 9, 2021
dade919
Fixed conditional for multiple outputs
HammadTheOne Oct 9, 2021
bce3387
Fix no_update test
HammadTheOne Oct 9, 2021
68343eb
Fixing callback_instrumentation test
HammadTheOne Oct 9, 2021
27b98b3
Fixing unit test
HammadTheOne Oct 9, 2021
bde703b
Added DBC to Dash R package (#273)
HammadTheOne Oct 12, 2021
3c5e5e0
Reverting sorted prop order
HammadTheOne Oct 13, 2021
582fd92
Checks updates
HammadTheOne Oct 13, 2021
f71ec43
Re-running test
HammadTheOne Oct 13, 2021
67f2ac0
Merge branch 'master' into dev
HammadTheOne Oct 13, 2021
f41bc4c
Remove html exports and update tags (#274)
HammadTheOne Oct 14, 2021
3e26723
CRAN submission updates
HammadTheOne Oct 20, 2021
e86a7bb
Fix callback outputs with short ID's (#280)
HammadTheOne Oct 27, 2021
bb021d3
Merge branch 'dev' of https://github.com/plotly/dashR into dev
HammadTheOne Nov 1, 2021
cec0d3c
Merge branch 'master' into dev
HammadTheOne Nov 1, 2021
a632b00
Updating README link
HammadTheOne Nov 1, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 2 additions & 21 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,21 +1,2 @@
MIT License

Copyright (c) 2019 Plotly

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
YEAR: 2021
COPYRIGHT HOLDER: Plotly, Inc.
4 changes: 2 additions & 2 deletions R/dash.R
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,7 @@ Dash <- R6::R6Class(
#'
#' For detailed examples of how to use pattern-matching callbacks, see the
#' entry for \link{selectors} or visit our interactive online
#' documentation at \url{https://dashr.plotly.com}.
#' documentation at \url{https://dash.plotly.com/r/}.
#'
#' The `output` argument defines which layout component property should
#' receive the results (via the [output] object). The events that
Expand Down Expand Up @@ -1149,7 +1149,7 @@ Dash <- R6::R6Class(
#' @param block Logical. Start the server while blocking console input? Default is `TRUE`.
#' @param showcase Logical. Load the Dash application into the default web browser when server starts? Default is `FALSE`.
#' @param use_viewer Logical. Load the Dash application into RStudio's viewer pane? Requires that `host` is either `127.0.0.1` or `localhost`, and that Dash application is started within RStudio; if `use_viewer = TRUE` and these conditions are not satisfied, the user is warned and the app opens in the default browser instead. Default is `FALSE`.
#' @param debug Logical. Enable/disable all the Dash developer tools (and the within-browser user interface for the callback graph visualizer and stack traces) unless overridden by the arguments or environment variables. Default is `FALSE` when called via `run_server`. For more information, please visit \url{https://dashr.plotly.com/devtools}. Environment variable: `DASH_DEBUG`.
#' @param debug Logical. Enable/disable all the Dash developer tools (and the within-browser user interface for the callback graph visualizer and stack traces) unless overridden by the arguments or environment variables. Default is `FALSE` when called via `run_server`. For more information, please visit \url{https://dash.plotly.com/r/devtools}. Environment variable: `DASH_DEBUG`.
#' @param dev_tools_ui Logical. Show Dash's developer tools UI? Default is `TRUE` if `debug == TRUE`, `FALSE` otherwise. Environment variable: `DASH_UI`.
#' @param dev_tools_hot_reload Logical. Activate hot reloading when app, assets, and component files change? Default is `TRUE` if `debug == TRUE`, `FALSE` otherwise. Requires that the Dash application is loaded using `source()`, so that `srcref` attributes are available for executed code. Environment variable: `DASH_HOT_RELOAD`.
#' @param dev_tools_hot_reload_interval Numeric. Interval in seconds for the client to request the reload hash. Default is `3`. Environment variable: `DASH_HOT_RELOAD_INTERVAL`.
Expand Down
28 changes: 21 additions & 7 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -338,12 +338,26 @@ clean_dependencies <- function(deps) {
}

insertIntoCallbackMap <- function(map, inputs, output, state, func, clientside_function) {
map[[createCallbackId(output)]] <- list(inputs=inputs,
output=output,
state=state,
func=func,
clientside_function=clientside_function
)
output_id <- createCallbackId(output)

if (output_id %in% names(map)) {
stop(
sprintf(
"One or more of the following outputs are duplicated across callbacks: %s. Please ensure that all ID and property combinations are unique.",
output_id
),
call. = FALSE
)
}

map[[output_id]] <- list(
inputs = inputs,
output = output,
state = state,
func = func,
clientside_function = clientside_function
)

if (length(map) >= 2) {
ids <- lapply(names(map), function(x) getIdProps(x)$ids)
props <- lapply(names(map), function(x) getIdProps(x)$props)
Expand Down Expand Up @@ -1139,7 +1153,7 @@ createCallbackId <- function(output) {
}

getIdProps <- function(output) {
output_ids <- strsplit(substr(output, 3, nchar(output)-2), '...', fixed=TRUE)
output_ids <- strsplit(gsub("^\\.{2}|\\.{2}$", "", output), '...', fixed=TRUE)
idprops <- lapply(output_ids, strsplit, '.', fixed=TRUE)
ids <- vapply(unlist(idprops, recursive=FALSE), '[', character(1), 1)
props <- vapply(unlist(idprops, recursive=FALSE), '[', character(1), 2)
Expand Down
141 changes: 56 additions & 85 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
[![CircleCI](https://circleci.com/gh/plotly/dashR/tree/master.svg?style=svg)](https://circleci.com/gh/plotly/dashR/tree/master)
[![CircleCI](https://circleci.com/gh/plotly/dashR/tree/master.svg?style=svg)](https://app.circleci.com/pipelines/github/plotly/dashR?branch=master)
[![GitHub](https://img.shields.io/github/license/plotly/dashR.svg?color=dark-green)](https://github.com/plotly/dashR/blob/master/LICENSE)
[![CRAN status](https://www.r-pkg.org/badges/version-ago/dash)](https://cran.r-project.org/web/packages/dash/index.html)
[![](http://cranlogs.r-pkg.org/badges/grand-total/dash)](https://cran.r-project.org/package=dash)
[![](https://cranlogs.r-pkg.org/badges/dash)](https://cran.r-project.org/package=dash)
[![CRAN status](https://www.r-pkg.org/badges/version-ago/dash)](https://CRAN.R-project.org/package=dash)
[![](http://cranlogs.r-pkg.org/badges/grand-total/dash)](https://CRAN.R-project.org/package=dash)
[![](https://cranlogs.r-pkg.org/badges/dash)](https://CRAN.R-project.org/package=dash)

# Dash for R

#### Create beautiful, analytic web applications in R.

[Documentation](https://dashr.plotly.com/) | [Gallery](https://dash-gallery.plotly.host/Portal/)
[Documentation](https://dash.plotly.com/r/) | [Gallery](https://dash.gallery/Portal/)

## Installation

<https://dashr.plotly.com/installation>
<https://dash.plotly.com/r/installation>

> 🛑 Make sure you're on at least version `3.0.2` of R. You can see what version of R you have by entering `version` in the R CLI. [CRAN](https://cran.r-project.org/bin/) is the easiest place to download the latest R version.

Expand Down Expand Up @@ -42,9 +42,9 @@ That's it!

## Getting Started

<https://dashr.plotly.com/getting-started>
<https://dash.plotly.com/r/layout>

The R package **dash** makes it easy to create reactive web applications powered by R. It provides an [R6](https://cran.r-project.org/web/packages/R6/index.html) class, named `Dash`, which may be initialized via the `new()` method.
The R package **dash** makes it easy to create reactive web applications powered by R. It provides an [R6](https://CRAN.R-project.org/package=R6) class, named `Dash`, which may be initialized via the `new()` method.

```r
library(dash)
Expand All @@ -55,96 +55,67 @@ app <- Dash$new()
Similar to [Dash for Python](https://github.com/plotly/dash) and [Dash for Julia](https://github.com/plotly/Dash.jl), every Dash for R application needs a layout (i.e., user interface) and a collection of callback functions which define the updating logic to perform when input value(s) change. Take, for instance, this basic example of formatting a string:

```r
app$layout(
htmlDiv(
list(
dccInput(id = "inputID", value = "initial value", type = "text"),
htmlDiv(id = "outputID")
)
)
)

app$callback(output = list(id="outputID", property="children"),
params = list(input(id="inputID", property="value"),
state(id="inputID", property="type")),
function(x, y) {
sprintf("You've entered: '%s' into a '%s' input control", x, y)
}
)
library(dash)

app$run_server(showcase = TRUE)
dash_app() %>%
set_layout(
dccInput(id = "text", "sample"),
div("CAPS: ", span(id = "out1")),
div("small: ", span(id = "out2"))
) %>%
add_callback(
list(
output("out1", "children"),
output("out2", "children")
),
input("text", "value"),
function(text) {
list(
toupper(text),
tolower(text)
)
}
) %>%
run_app()
```

Here the `showcase = TRUE` argument opens a browser window and automatically loads the Dash app for you.

## Hello world example using `dccGraph`

```r
app <- Dash$new()
library(dash)

app$layout(
htmlDiv(
list(
dccInput(id = "graphTitle",
value = "Let's Dance!",
type = "text"),
htmlDiv(id = "outputID"),
dccGraph(id = "giraffe",
figure = list(
data = list(x = c(1,2,3), y = c(3,2,8), type = "bar"),
layout = list(title = "Let's Dance!")
)
)
# Create a Dash app
app <- dash_app()

# Set the layout of the app
app %>% set_layout(
h1('Hello Dash'),
div("Dash: A web application framework for your data."),
dccGraph(
figure = list(
data = list(
list(
x = list(1, 2, 3),
y = list(4, 1, 2),
type = 'bar',
name = 'SF'
),
list(
x = list(1, 2, 3),
y = list(2, 4, 5),
type = 'bar',
name = 'Montr\U{00E9}al'
)
),
layout = list(title = 'Dash Data Visualization')
)
)
)

app$callback(output = list(id = "giraffe", property = "figure"),
params = list(input("graphTitle", "value")),
function(newTitle) {

rand1 <- sample(1:10, 1)

rand2 <- sample(1:10, 1)
rand3 <- sample(1:10, 1)
rand4 <- sample(1:10, 1)

x <- c(1,2,3)
y <- c(3,6,rand1)
y2 <- c(rand2,rand3,rand4)

df = data.frame(x, y, y2)

list(
data =
list(
list(
x = df$x,
y = df$y,
type = "bar"
),
list(
x = df$x,
y = df$y2,
type = "scatter",
mode = "lines+markers",
line = list(width = 4)
)
),
layout = list(title = newTitle)
)
}
)

app$callback(output = list(id = "outputID", property = "children"),
params = list(input("graphTitle", "value"),
state("graphTitle", "type")),
function(x, y) {
sprintf("You've entered: '%s' into a '%s' input control", x, y)
}
)

app$run_server(showcase = TRUE)
# Run the app
app %>% run_app()
```

---
Expand Down
4 changes: 2 additions & 2 deletions man/Dash.Rd

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

4 changes: 2 additions & 2 deletions man/dash-package.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ Dash apps are rendered in the web browser. You can deploy your apps to servers a

There is a lot behind the framework. To learn more about how it is built and what motivated Dash, watch our talk from \href{https://youtu.be/5BAthiN0htc}{Plotcon} or read our \href{https://medium.com/@plotlygraphs/introducing-dash-5ecf7191b503}{announcement letter}.

Dash is an open source package, released under the permissive MIT license. Plotly develops Dash and offers a \href{https://plotly.com/dash/pricing/}{platform for easily deploying Dash apps in an enterprise environment}. If you're interested, \href{https://plotly.typeform.com/to/rkO85m?_ga=2.223907347.9240264.1560484539-2037997284.1554944507}{please get in touch}.
Dash is an open source package, released under the permissive MIT license. Plotly develops Dash and offers a \href{https://plotly.com/dash/}{platform for easily deploying Dash apps in an enterprise environment}. If you're interested, \href{https://plotly.com/get-pricing/}{please get in touch}.
}
\seealso{
Useful links:
\itemize{
\item \url{http://dashr.plotly.com}
\item \url{https://dash.plotly.com/r/}
\item \url{https://github.com/plotly/dashR}
\item Report bugs at \url{https://github.com/plotly/dashR/issues}
}
Expand Down
Loading