8000 GitHub - cynkra/g6R: htmlwidget for the G6 Graph Visualization Framework
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

cynkra/g6R

Repository files navigation

g6R

R-CMD-check Lifecycle: experimental

{g6R} provides R bindings to the G6 graph library.

Installation

You can install the development version of {g6R} from GitHub with:

# install.packages("pak")
pak::pak("cynkra/g6R")

Example

To create a g6 graph:

library(g6R)
nodes <- data.frame(
  id = as.character(1:10),
  label = as.character(1:10)
)

# Generate random edges
edges <- data.frame(
  source = c("2", "6", "7"),
  target = c("1", "3", "9")
)

g6(nodes, edges) |>
  g6_options(
    node = list(
      style = list(
        labelBackground = TRUE,
        labelBackgroundFill = '#FFB6C1',
        labelBackgroundRadius = 4,
        labelFontFamily = 'Arial',
        labelPadding = c(0, 4),
        labelText = JS(
          "(d) => {
              return d.id
            }"
        )
      )
    )
  ) |>
  g6_layout(d3_force_layout()) |>
  g6_behaviors(
    "zoom-canvas",
    drag_element_force(fixed = TRUE),
    click_select(
      multiple = TRUE,
      onClick = JS(
        "(e) => {
            console.log(e);
          }"
      )
    ),
    brush_select(),
    create_edge()
  ) |>
  g6_plugins(
    "minimap",
    "tooltip",
    context_menu()
  )

About

htmlwidget for the G6 Graph Visualization Framework

Topics

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0