Skip to content

Commit 32a0bdf

Browse files
committed
review CRAN issues
1 parent 3da178d commit 32a0bdf

13 files changed

+160
-105
lines changed

.Rbuildignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@
2121
^index\.md$
2222
^cran-comments\.md$
2323
^vignettes/articles$
24+
^CRAN-SUBMISSION$

CRAN-SUBMISSION

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Version: 0.1.0
2+
Date: 2025-07-03 09:32:36 UTC
3+
SHA: 3da178dd8286995549966ed1af73341a4f80e748

DESCRIPTION

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@ Title: Graph Visualisation Engine Widget for R and 'shiny' Apps
33
Version: 0.1.0
44
Authors@R:
55
c(
6-
person("David", "Granjon", , "[email protected]", role = c("aut", "cre")),
7-
person("David", "Schoch", , "[email protected]", role = c("aut")),
8-
person(family = "cynkra GmbH", role = "fnd"),
9-
person(family = "Bristol Myers Squibb", role = "fnd")
6+
person("David", "Granjon", , "[email protected]", role = c("aut", "cre")),
7+
person("David", "Schoch", , "[email protected]", role = c("aut")),
8+
person(family = "cynkra GmbH", role = "fnd"),
9+
person(family = "Bristol Myers Squibb", role = "fnd")
1010
)
11-
Description: Create stunning network experiences powered by the 'G6' graph visualisation engine
12-
'JavaScript' library <https://g6.antv.antgroup.com/en>. In 'shiny' mode, modify your
13-
graph directly from the server function to dynamically interact with nodes and edges.
14-
Select your favorite layout among 20 choices. 15 behaviors are available such as
11+
Description: Create stunning network experiences powered by the 'G6' graph visualisation engine
12+
'JavaScript' library <https://g6.antv.antgroup.com/en>. In 'shiny' mode, modify your
13+
graph directly from the server function to dynamically interact with nodes and edges.
14+
Select your favorite layout among 20 choices. 15 behaviors are available such as
1515
interactive edge creation, collapse-expand and brush select.
16-
17 plugins designed to improve the user experience such as a mini-map,
16+
17 plugins designed to improve the user experience such as a mini-map,
1717
toolbars and grid lines. Customise the look and feel of your graph with comprehensive
1818
options for nodes, edges and more.
1919
License: MIT + file LICENSE
@@ -33,7 +33,8 @@ Suggests:
3333
roxy.shinylive,
3434
testthat (>= 3.0.0),
3535
stringr,
36-
htmltools
36+
htmltools,
37+
bslib
3738
VignetteBuilder: quarto, knitr
3839
Depends:
3940
R (>= 4.1.0)

R/layouts.R

Lines changed: 34 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -882,18 +882,18 @@ dagre_layout <- function(
882882
#' @export
883883
#'
884884
#' @examples
885-
#' \dontrun{
886-
#' g6(lesmis$nodes, lesmis$edges) |>
887-
#' g6_layout(force_atlas2_layout(
888-
#' kr = 20,
889-
#' preventOverlap = TRUE,
890-
#' center = c(250, 250))) |>
891-
#' g6_options(autoResize = TRUE) |>
892-
#' g6_behaviors(
893-
#' "zoom-canvas",
894-
#' drag_element()
895-
#' )
896-
#'}
885+
#' if (interactive()) {
886+
#' g6(lesmis$nodes, lesmis$edges) |>
887+
#' g6_layout(force_atlas2_layout(
888+
#' kr = 20,
889+
#' preventOverlap = TRUE,
890+
#' center = c(250, 250))) |>
891+
#' g6_options(autoResize = TRUE) |>
892+
#' g6_behaviors(
893+
#' "zoom-canvas",
894+
#' drag_element()
895+
#' )
896+
#' }
897897
force_atlas2_layout <- function(
898898
barnesHut = NULL,
899899
dissuadeHubs = FALSE,
@@ -991,16 +991,16 @@ force_atlas2_layout <- function(
991991
#' @return A list containing the configuration for G6 fruchterman layout.
992992
#' @export
993993
#' @examples
994-
#' \dontrun{
995-
#' g6(lesmis$nodes, lesmis$edges) |>
996-
#' g6_layout(fruchterman_layout(
997-
#' gravity = 5,
998-
#' speed = 5
999-
#' )) |>
1000-
#' g6_behaviors(
1001-
#' "zoom-canvas",
1002-
#' drag_element()
1003-
#' )
994+
#' if (interactive()) {
995+
#' g6(lesmis$nodes, lesmis$edges) |>
996+
#' g6_layout(fruchterman_layout(
997+
#' gravity = 5,
998+
#' speed = 5
999+
#' )) |>
1000+
#' g6_behaviors(
1001+
#' "zoom-canvas",
1002+
#' drag_element()
1003+
#' )
10041004
#' }
10051005
#'
10061006
fruchterman_layout <- function(
@@ -1058,17 +1058,18 @@ fruchterman_layout <- function(
10581058
#' @return A list containing the configuration for G6 radial layout.
10591059
#' @export
10601060
#' @examples
1061-
#' \dontrun{
1062-
#' radial <- jsonlite::fromJSON("https://assets.antv.antgroup.com/g6/radial.json")
1063-
#' g6(radial$nodes, radial$edges) |>
1064-
#' g6_layout(radial_layout(
1065-
#' unitRadius = 100,
1066-
#' linkDistance = 200
1067-
#' )) |>
1068-
#' g6_behaviors(
1069-
#' "zoom-canvas",
1070-
#' drag_element()
1071-
#' )
1061+
#' if (interactive()) {
1062+
#' g6(jsonUrl = "https://assets.antv.antgroup.com/g6/radial.json") |>
1063+
#' g6_layout(
1064+
#' radial_layout(
1065+
#' unitRadius = 100,
1066+
#' linkDistance = 200
1067+
#' )
1068+
#' ) |>
1069+
#' g6_behaviors(
1070+
#' "zoom-canvas",
1071+
#' drag_element()
1072+
#' )
10721073
#' }
10731074
#'
10741075
radial_layout <- function(
@@ -1242,7 +1243,6 @@ dendrogram_layout <- function(
12421243
#' the outer layout manages the overall arrangement.
12431244
#'
12441245
#' @examples
1245-
#' \dontrun{
12461246
#' # Basic combo combined layout
12471247
#' layout <- combo_combined_layout()
12481248
#'
@@ -1252,7 +1252,6 @@ dendrogram_layout <- function(
12521252
#' nodeSize = 15,
12531253
#' spacing = 10
12541254
#' )
1255-
#' }
12561255
#'
12571256
#' @seealso \code{\link{antv_dagre_layout}} for dagre layout configuration
12581257
#'

R/proxy.R

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -99,19 +99,39 @@ g6_get <- function(graph, el, type) {
9999
#' @rdname g6-get
100100
#' @export
101101
#' @examples
102-
#' \dontrun{
103-
#' # Send query to JS
104-
#' observeEvent(req(input[["graph-initialized"]]), {
105-
#' g6_proxy("graph") |> g6_get_nodes(c("node1", "node2"))
106-
#' })
107-
#'
108-
#' # Recover query result inside input[["<GRAPH_ID>-<ELEMENT_ID>-state"]]
109-
#' output$res <- renderPrint({
110-
#' list(
111-
#' node1_state = input[["graph-node1-state"]],
112-
#' node2_state = input[["graph-node2-state"]]
113-
#' )
114-
#' })
102+
#' if (interactive()) {
103+
#' library(shiny)
104+
#' library(bslib)
105+
#'
106+
#' ui <- page_fluid(
107+
#' verbatimTextOutput("res"),
108+
#' g6Output("graph")
109+
#' )
110+
#'
111+
#' server <- function(input, output, session) {
112+
#' output$graph <- renderG6({
113+
#' g6(
114+
#' nodes = data.frame(id = c("node1", "node2"))
115+
#' ) |>
116+
#' g6_options(animation = FALSE) |>
117+
#' g6_layout() |>
118+
#' g6_behaviors(click_select())
119+
#' })
120+
#'
121+
#' # Send query to JS
122+
#' observeEvent(req(input[["graph-initialized"]]), {
123+
#' g6_proxy("graph") |> g6_get_nodes(c("node1", "node2"))
124+
#' })
125+
#'
126+
#' # Recover query result inside input[["<GRAPH_ID>-<ELEMENT_ID>-state"]]
127+
#' output$res <- renderPrint({
128+
#' list(
129+
#' node1_state = input[["graph-node1-state"]],
130+
#' node2_state = input[["graph-node2-state"]]
131+
#' )
132+
#' })
133+
#' }
134+
#' shinyApp(ui, server)
115135
#' }
116136
g6_get_nodes <- function(graph, nodes) {
117137
g6_get(graph, nodes, type = "Node")

R/utils.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ dropNulls <- function(x) {
1010
#' @param ... Any valid JS element.
1111
#'
1212
#' @export
13+
#' @return A character vector with class "JS_EVAL" that can be used in htmlwidgets
14+
#' to mark is as a JavaScript function.
1315
JS <- function(...) {
1416
x <- c(...)
1517
if (is.null(x)) {

cran-comments.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,9 @@
44

55
* This is a new release.
66
* I kept only 1 vignette within doc (Getting started) as it is very large to due to the underlying JavaScript [dependencies](https://github.com/antvis/G6) (the dependency would be typically copied for each vignette which can easily grow to 10MB). I have no way to reduce the size further as I am not maintainer of the G6 JavaScript API. The g6R JavaScript assets have been minimized as much as possible using standard JS minification techniques powered by webpack.
7+
8+
### Resubmission
9+
10+
* Fixed DESCRIPTION spaces.
11+
* Add missing `@return` to `JS()` documentation.
12+
* Do not use `dontrun` in roxygen doc. Replaced by `if (interactive())` in some contexts.

man/JS.Rd

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/combo_combined_layout.Rd

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/force_atlas2_layout.Rd

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)