-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from timelyportfolio/master
fix multiple radviz on a page
- Loading branch information
Showing
6 changed files
with
220 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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']; }") | ||
} | ||
) | ||
) | ||
``` |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,42 @@ | ||
body { | ||
font-family: sans-serif; | ||
} | ||
.panel { | ||
.radviz .panel { | ||
stroke: black; | ||
fill: white; | ||
} | ||
|
||
.bg { | ||
.radviz .bg { | ||
fill: white; | ||
} | ||
|
||
.link { | ||
.radviz .link { | ||
stroke: silver; | ||
stroke-opacity: 0.05 | ||
} | ||
|
||
.dot { | ||
.radviz dot { | ||
fill-opacity: 0.5; | ||
} | ||
|
||
.label-node { | ||
.radviz label-node { | ||
fill: silver; | ||
} | ||
|
||
.active { | ||
.radviz .active { | ||
stroke: black; | ||
} | ||
|
||
.label { | ||
.radviz .label { | ||
fill: gray; | ||
pointer-events: none; | ||
} | ||
|
||
#tooltip { | ||
.radviz-tooltip { | ||
font-size: 12px; | ||
margin-top: 22px; | ||
background-color: rgba(255, 255, 255, 0.8); | ||
border-radius: 4px; | ||
} | ||
|
||
#tooltip h1 { | ||
.radviz-tooltip h1 { | ||
font-size: 14px; | ||
margin: 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters