graph2json {RGraph2js} | R Documentation

## Generates JSON string correponding the the graph description

### Description

Generates JSON string correponding the the graph description

### Usage

    graph2json(ndf, edf, innerValues = NULL, innerColors = NULL,
      innerTexts = NULL, starplotColors = NULL, starplotValues = NULL,
      starplotLabels = NULL, starplotTooltips = NULL, starplotUrlLinks = NULL,
      starplotSectorStartRad = NULL, starplotCircleFillColor = NULL,
      starplotCircleFillOpacity = NULL)

### Arguments

`ndf` | A `data.frame` correponding to nodes definition
`edf` | A `data.frame` correponding to edges definition
`innerValues` | A `matrix` of numerical values for plotting in the node
`innerColors` | A `matrix` of string colors values for plotting in the node
`innerTexts` | A `matrix` of strings for plotting in the node
`starplotColors` | A `matrix` of hex RGB colors for sectors colors
`starplotValues` | A `matrix` of [0,1] values for starpot sectors size
`starplotLabels` | A `matrix` of labels identifying the sectors
`starplotTooltips` | A `matrix` of text or even html content for the sectors tooltips
`starplotUrlLinks` | A `matrix` of text for the sectors url links
`starplotSectorStartRad` | A `matrix` with a single column of [0,2PI] values for the sector start in radians
`starplotCircleFillColor` | A `matrix` of hex RGB colors for the circle background
`starplotCircleFillOpacity` | A `matrix` of [0.0,1.0] values for the circle background opacity

### Value

A JSON string with formatting

### Author(s)

Sylvain Gubian DL.RSupport@pmi.com

### Examples

    v <- c(0, 0, 1, 1, 0,
           0, 0, 0, 0, 0,
          -1, 0, 0, 1, 0)
    a <- matrix(v, 3, 5)
    colnames(a) <- LETTERS[1:5]
    rownames(a) <- LETTERS[1:3]

    nGlobal <- list(color="#dedeff")
    nProp <- data.frame(shape=c('triangle', 'lozenge'))
    rownames(nProp) <- c('C', 'E')
    ndf <-getNodesDataFrame(A=a, nGlobal=nGlobal, nProp=nProp)

    eGlobal <- list(color="#5555ff")
    eProp <- data.frame(from=c('A','C'), to=c('B', 'A'), width=c(2,2))
    edf <- getEdgesDataFrame(A=a, eGlobal=eGlobal, eProp=eProp)

    graph2json(ndf=ndf, edf=edf)

[Package RGraph2js version 1.14.0 Index]