diff --git a/README.md b/README.md index 33324d7..3fec593 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ Add more interactivity to interactive charts ================ -[![CRAN Status Badge](http://www.r-pkg.org/badges/version/manipulateWidget)](http://cran.r-project.org/package=manipulateWidget) [![CRAN Downloads Badge](https://cranlogs.r-pkg.org/badges/manipulateWidget)](http://cran.r-project.org/package=manipulateWidget)[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/rte-antares-rpackage/manipulateWidget?branch=master&svg=true)](https://ci.appveyor.com/project/rte-antares-rpackage/manipulateWidget)[![Travis-CI Build Status](https://travis-ci.org/rte-antares-rpackage/manipulateWidget.svg?branch=master)](https://travis-ci.org/rte-antares-rpackage/manipulateWidget)[![Coverage Status](https://img.shields.io/codecov/c/github/rte-antares-rpackage/manipulateWidget/master.svg)](https://codecov.io/github/rte-antares-rpackage/manipulateWidget?branch=master) +[![CRAN Status Badge](http://www.r-pkg.org/badges/version/manipulateWidget)](http://cran.r-project.org/package=manipulateWidget) [![CRAN Downloads Badge](https://cranlogs.r-pkg.org/badges/manipulateWidget)](http://cran.r-project.org/package=manipulateWidget) This R package is largely inspired by the `manipulate` package from Rstudio. It provides the function `manipulateWidget` that can be used to create in a very easy way a graphical interface that let the user modify the data or the parameters of an interactive chart. Technically, the function generates a Shiny gadget, but the user does not even have to know what is Shiny. diff --git a/vignettes/comparison.gif b/vignettes/comparison.gif index 2f6c701..e00cc32 100644 Binary files a/vignettes/comparison.gif and b/vignettes/comparison.gif differ diff --git a/vignettes/conditional-inputs.gif b/vignettes/conditional-inputs.gif index 458f205..8b13515 100644 Binary files a/vignettes/conditional-inputs.gif and b/vignettes/conditional-inputs.gif differ diff --git a/vignettes/dynamic_inputs.gif b/vignettes/dynamic_inputs.gif index 1c111cd..65cacc1 100644 Binary files a/vignettes/dynamic_inputs.gif and b/vignettes/dynamic_inputs.gif differ diff --git a/vignettes/example-kmeans.gif b/vignettes/example-kmeans.gif index 76a4341..4d6e22a 100644 Binary files a/vignettes/example-kmeans.gif and b/vignettes/example-kmeans.gif differ diff --git a/vignettes/fancy-example.gif b/vignettes/fancy-example.gif index c07259b..e5bac77 100644 Binary files a/vignettes/fancy-example.gif and b/vignettes/fancy-example.gif differ diff --git a/vignettes/groups-inputs.gif b/vignettes/groups-inputs.gif index 099d8bc..e46b320 100644 Binary files a/vignettes/groups-inputs.gif and b/vignettes/groups-inputs.gif differ diff --git a/vignettes/manipulateWidgets.Rmd b/vignettes/manipulateWidgets.Rmd index f755935..a1159dd 100644 --- a/vignettes/manipulateWidgets.Rmd +++ b/vignettes/manipulateWidgets.Rmd @@ -100,6 +100,31 @@ combineWidgets( ## Advanced usage +### Comparison mode + +Sometimes one wants to compare two similar charts to visualize the impact of some parameter or to compare different data sets. `manipulateWidget` has an argument to perform such comparison without writing much code: `.compare`. One just has to write the code to generate one chart and use this argument to specify which parameters should vary between the two charts. Here is a toy example that uses `dygraphs`. + +```{r eval=FALSE} +mydata <- data.frame( + timeId = 1:100, + series1 = rnorm(100), + series2 = rnorm(100), + series3 = rnorm(100) +) +manipulateWidget( + dygraph(mydata[range[1]:range[2], c("timeId", series)], main = title), + range = mwSlider(1, 100, c(1, 100)), + series = mwSelect(c("series1", "series2", "series3")), + title = mwText(), + .compare = list( + title = list("First chart", "Second chart"), + series = NULL + ) +) +``` + +![Comparison mode](comparison.gif) + ### Grouping controls If you have a large number of inputs, you can easily group them. To do so, simply use function `mwGroup()`. Here is a toy example. Groups are by default collapsed and user can click on their title to display/collapse then. @@ -218,31 +243,6 @@ manipulateWidget(myMapFun(radius, color, .initial, .session, .output), ![Conditional inputs](update-widget.gif) -### Comparison mode - -Sometimes one wants to compare two similar charts to visualize the impact of some parameter or to compare different data sets. `manipulateWidget` has an argument to perform such comparison without writing much code: `.compare`. One just has to write the code to generate one chart and use this argument to specify which parameters should vary between the two charts. Here is a toy example that uses `dygraphs`. - -```{r eval=FALSE} -mydata <- data.frame( - timeId = 1:100, - series1 = rnorm(100), - series2 = rnorm(100), - series3 = rnorm(100) -) -manipulateWidget( - dygraph(mydata[range[1]:range[2], c("timeId", series)], main = title), - range = mwSlider(1, 100, c(1, 100)), - series = mwSelect(c("series1", "series2", "series3")), - title = mwText(), - .compare = list( - title = list("First chart", "Second chart"), - series = NULL - ) -) -``` - -![Comparison mode](comparison.gif) - ### Using `manipulateWidget` in a document `manipulateWidget` uses Shiny, so it does not work in a "normal" Rmarkdown document. If one uses the function in a code chunck, the htmlwidget will be outputed with the default values of the parameters and there will be no interface to modify the parameters. diff --git a/vignettes/update-widget.gif b/vignettes/update-widget.gif index 6fcdccb..f6a604c 100644 Binary files a/vignettes/update-widget.gif and b/vignettes/update-widget.gif differ