Skip to content

Commit

Permalink
use correct syntax in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
rpkyle authored May 29, 2020
1 parent 0c92fc0 commit fa4ad5f
Showing 1 changed file with 22 additions and 11 deletions.
33 changes: 22 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,22 @@ The R package **dash** makes it easy to create reactive web applications powered

```r
library(dash)
library(dashHtmlComponents)
library(dashCoreComponents)

app <- Dash$new()
```

Similar to [Dash for Python](https://github.com/plotly/dash), 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(
dccInput(id = "inputID", value = "initial value", type = "text"),
htmlDiv(id = "outputID")
htmlDiv(
list(
dccInput(id = "inputID", value = "initial value", type = "text"),
htmlDiv(id = "outputID")
)
)
)

app$callback(output = list(id="outputID", property="children"),
Expand All @@ -80,15 +87,19 @@ Here the `showcase = TRUE` argument opens a browser window and automatically loa
app <- Dash$new()

app$layout(
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!")
)
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!")
)
)
)
)
)

Expand Down

0 comments on commit fa4ad5f

Please sign in to comment.