diff --git a/inst/examples/test_multiple_shiny.R b/inst/examples/test_multiple_shiny.R new file mode 100644 index 0000000..fbb4187 --- /dev/null +++ b/inst/examples/test_multiple_shiny.R @@ -0,0 +1,44 @@ +# silly test to check multiple radviz on a page +# and make sure tooltips work as expected + +library(shiny) +library(radviz) + +ui <- fluidPage( + fluidRow( + column( + width = 6, + radvizOutput("radviz1") + ), + column( + width = 6, + radvizOutput("radviz2") + ) + ) +) + +server <- function(input,output,session){ + output$radviz1 <- renderRadviz({ + radviz(iris, diameter=400, margin=100, + use_repulsion=TRUE, draw_links=TRUE, + width=400, height=500 + ) %>% + add_dimensions(c('Sepal.Length', 'Sepal.Width', + 'Petal.Length', 'Petal.Width')) %>% + add_color("Species") %>% + add_tooltip("function(d){ return 'Petal width: ' + d['Petal.Length']; }") + }) + + output$radviz2 <- renderRadviz({ + radviz(iris, diameter=400, margin=100, + use_repulsion=TRUE, draw_links=TRUE, + width=400, height=500 + ) %>% + add_dimensions(c('Sepal.Length', 'Sepal.Width', + 'Petal.Length', 'Petal.Width')) %>% + add_color("Species") %>% + add_tooltip("function(d){ return 'Petal width: ' + d['Petal.Length']; }") + }) +} + +shinyApp(ui,server) diff --git a/inst/examples/testmultiple_radviz.Rmd b/inst/examples/testmultiple_radviz.Rmd new file mode 100644 index 0000000..c8766ee --- /dev/null +++ b/inst/examples/testmultiple_radviz.Rmd @@ -0,0 +1,31 @@ +--- +title: "radviz_testmultiple" +author: "Kent Russell" +date: "March 5, 2016" +output: html_document +--- + +```{r setup, include=FALSE} +knitr::opts_chunk$set(echo = TRUE) +``` + +```{r} +library(htmltools) +library(radviz) + +tagList( + lapply( + 1:2, + function(x){ + radviz(iris, diameter=600, margin=100, + use_repulsion=TRUE, draw_links=TRUE, + width=600, height=500 + ) %>% + add_dimensions(c('Sepal.Length', 'Sepal.Width', + 'Petal.Length', 'Petal.Width')) %>% + add_color("Species") %>% + add_tooltip("function(d){ return 'Petal width: ' + d['Petal.Length']; }") + } + ) +) +``` diff --git a/inst/examples/testmultiple_radviz.html b/inst/examples/testmultiple_radviz.html new file mode 100644 index 0000000..a423091 --- /dev/null +++ b/inst/examples/testmultiple_radviz.html @@ -0,0 +1,124 @@ + + + + +
+ + + + + + + + +library(htmltools)
+## Warning: package 'htmltools' was built under R version 3.2.3
+library(radviz)
+
+tagList(
+ lapply(
+ 1:2,
+ function(x){
+ radviz(iris, diameter=600, margin=100,
+ use_repulsion=TRUE, draw_links=TRUE,
+ width=600, height=500
+ ) %>%
+ add_dimensions(c('Sepal.Length', 'Sepal.Width',
+ 'Petal.Length', 'Petal.Width')) %>%
+ add_color("Species") %>%
+ add_tooltip("function(d){ return 'Petal width: ' + d['Petal.Length']; }")
+ }
+ )
+)
+
+
+
+
+
+
+