From 20605a8c5835eab024b6eaebee95fac2ec5604b8 Mon Sep 17 00:00:00 2001 From: Xing Han Lu Date: Wed, 27 Jan 2021 12:01:09 -0500 Subject: [PATCH 1/7] Add R Snippet --- README.md | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 52a2c0c..5faefc9 100644 --- a/README.md +++ b/README.md @@ -47,8 +47,35 @@ For a more detailed example, see `usage.py`. ### Quickstart (R) -This section will be added soon. +First, install the package from GitHub (the package is not yet available via CRAN): +``` +remotes::install_github("plotly/dash-deck") +``` + +then, create your component and add it to your layout: + +```r +library(dash) +library(dashVtk) +library(dashHtmlComponents) + + +layout = htmlDiv( + style=list("width" = "100%", "height" = "calc(100vh - 16px)"), + children = View(list( + GeometryRepresentation( + Algorithm( + vtkClass="vtkConeSource", + state=list("resolution" = 64, "capping" = FALSE), + ) + )), + ]), +) + +app <- Dash$new() +app$layout(layout) +``` ## Contributing See [docs/CONTRIBUTING.md](./docs/CONTRIBUTING.md) to learn about: @@ -111,4 +138,4 @@ You can find the complete API reference in [`docs/REFERENCES.md`](./docs/REFEREN * [Code](./demos/usage-algorithm) * Online Demo (coming soon) -![A demo of the usage-algorithm app](demos/usage-algorithm/demo.jpg) \ No newline at end of file +![A demo of the usage-algorithm app](demos/usage-algorithm/demo.jpg) From 67451ff9d1f2436fb829266bd2d235758c91e568 Mon Sep 17 00:00:00 2001 From: Xing Han Lu Date: Wed, 27 Jan 2021 12:04:12 -0500 Subject: [PATCH 2/7] Fix some stuff --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5faefc9..2bdfcad 100644 --- a/README.md +++ b/README.md @@ -60,16 +60,16 @@ library(dashVtk) library(dashHtmlComponents) -layout = htmlDiv( +layout <- htmlDiv( style=list("width" = "100%", "height" = "calc(100vh - 16px)"), children = View(list( GeometryRepresentation( Algorithm( - vtkClass="vtkConeSource", + vtkClass = "vtkConeSource", state=list("resolution" = 64, "capping" = FALSE), ) )), - ]), + ), ) app <- Dash$new() From be743749943006b89d8ed130873fc654c77fa8b8 Mon Sep 17 00:00:00 2001 From: Xing Han Lu Date: Wed, 27 Jan 2021 12:05:26 -0500 Subject: [PATCH 3/7] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 2bdfcad..b2bd840 100644 --- a/README.md +++ b/README.md @@ -66,10 +66,10 @@ layout <- htmlDiv( GeometryRepresentation( Algorithm( vtkClass = "vtkConeSource", - state=list("resolution" = 64, "capping" = FALSE), + state = list("resolution" = 64, "capping" = FALSE), ) - )), - ), + ), + )), ) app <- Dash$new() From 1de09f56b272736dbf454106595812de8bbcffc3 Mon Sep 17 00:00:00 2001 From: Xing Han Lu Date: Wed, 27 Jan 2021 12:06:06 -0500 Subject: [PATCH 4/7] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b2bd840..002126a 100644 --- a/README.md +++ b/README.md @@ -61,15 +61,15 @@ library(dashHtmlComponents) layout <- htmlDiv( - style=list("width" = "100%", "height" = "calc(100vh - 16px)"), + style = list("width" = "100%", "height" = "calc(100vh - 16px)"), children = View(list( GeometryRepresentation( Algorithm( vtkClass = "vtkConeSource", state = list("resolution" = 64, "capping" = FALSE), ) - ), - )), + ) + )) ) app <- Dash$new() From 86e852384c80bd8b51f90359d5a3ff88c28ce2f3 Mon Sep 17 00:00:00 2001 From: Xing Han Lu Date: Thu, 28 Jan 2021 18:14:27 -0500 Subject: [PATCH 5/7] Apply suggestions from code review Co-authored-by: Ryan Patrick Kyle --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 002126a..4b85df1 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ For a more detailed example, see `usage.py`. First, install the package from GitHub (the package is not yet available via CRAN): ``` -remotes::install_github("plotly/dash-deck") +remotes::install_github("plotly/dash-vtk") ``` then, create your component and add it to your layout: From a4a1f1dbb1d04bf11ea414b6e3bdccdb0d56e931 Mon Sep 17 00:00:00 2001 From: xhlulu Date: Thu, 28 Jan 2021 18:19:57 -0500 Subject: [PATCH 6/7] Fix links --- README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 4b85df1..4091c9d 100644 --- a/README.md +++ b/README.md @@ -59,12 +59,11 @@ library(dash) library(dashVtk) library(dashHtmlComponents) - layout <- htmlDiv( style = list("width" = "100%", "height" = "calc(100vh - 16px)"), - children = View(list( - GeometryRepresentation( - Algorithm( + children = vtkView(list( + vtkGeometryRepresentation( + vtkAlgorithm( vtkClass = "vtkConeSource", state = list("resolution" = 64, "capping" = FALSE), ) @@ -75,6 +74,8 @@ layout <- htmlDiv( app <- Dash$new() app$layout(layout) + +app$run_server() ``` ## Contributing From 4422e890e9dd145553c53b536e39250c5be1d9f1 Mon Sep 17 00:00:00 2001 From: xhlulu Date: Thu, 28 Jan 2021 21:03:07 -0500 Subject: [PATCH 7/7] refactor R example on readme --- README.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 4091c9d..e9654ee 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,9 @@ library(dash) library(dashVtk) library(dashHtmlComponents) -layout <- htmlDiv( +app <- Dash$new() + +app$layout(htmlDiv( style = list("width" = "100%", "height" = "calc(100vh - 16px)"), children = vtkView(list( vtkGeometryRepresentation( @@ -69,11 +71,7 @@ layout <- htmlDiv( ) ) )) -) - -app <- Dash$new() - -app$layout(layout) +)) app$run_server() ```