Description Usage Arguments Value Author(s) Examples
View source: R/dataformating.R
Generates JSON string correponding the the graph description
1 2 3 4 5 |
ndf |
A |
edf |
A |
innerValues |
A |
innerColors |
A |
innerTexts |
A |
starplotColors |
A |
starplotValues |
A |
starplotLabels |
A |
starplotTooltips |
A |
starplotUrlLinks |
A |
starplotSectorStartRad |
A |
starplotCircleFillColor |
A |
starplotCircleFillOpacity |
A |
A JSON string with formatting
Sylvain Gubian DL.RSupport@pmi.com
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | 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)
|
RGraph2js: Convert a Graph into a D3js Script
Version 1.4.0 created on 2016-05-09.
Copyright (c) 2015 Stephane Cano, Sylvain Gubian, Florian Martin, PMP S.A.
Licensed under the GNU GENERAL PUBLIC LICENSE Version 2 <https://www.gnu.org/licenses/gpl-2.0.txt>.
[1] "{\"nodes\":[{\"shape\":\"circle\",\"color\":\"#dedeff\",\"id\":\"A\",\"urlLink\":\"\",\"name\":\"A\",\"nodeTooltipHtmlContent\":\"\",\"borderWidth\":1,\"barplotTexts\":[\"\"],\"barplotValues\":[0],\"barplotColors\":[\"#FFFFFF\"],\"starplotValues\":null,\"starplotColors\":null,\"starplotLabels\":null,\"starplotTooltips\":null,\"starplotUrlLinks\":null,\"starplotSectorStartRad\":[],\"starplotCircleFillColor\":[],\"starplotCircleFillOpacity\":[],\"x\":null,\"y\":null,\"fixed\":null},{\"shape\":\"circle\",\"color\":\"#dedeff\",\"id\":\"B\",\"urlLink\":\"\",\"name\":\"B\",\"nodeTooltipHtmlContent\":\"\",\"borderWidth\":1,\"barplotTexts\":[\"\"],\"barplotValues\":[0],\"barplotColors\":[\"#FFFFFF\"],\"starplotValues\":null,\"starplotColors\":null,\"starplotLabels\":null,\"starplotTooltips\":null,\"starplotUrlLinks\":null,\"starplotSectorStartRad\":[],\"starplotCircleFillColor\":[],\"starplotCircleFillOpacity\":[],\"x\":null,\"y\":null,\"fixed\":null},{\"shape\":\"triangle\",\"color\":\"#dedeff\",\"id\":\"C\",\"urlLink\":\"\",\"name\":\"C\",\"nodeTooltipHtmlContent\":\"\",\"borderWidth\":1,\"barplotTexts\":[\"\"],\"barplotValues\":[0],\"barplotColors\":[\"#FFFFFF\"],\"starplotValues\":null,\"starplotColors\":null,\"starplotLabels\":null,\"starplotTooltips\":null,\"starplotUrlLinks\":null,\"starplotSectorStartRad\":[],\"starplotCircleFillColor\":[],\"starplotCircleFillOpacity\":[],\"x\":null,\"y\":null,\"fixed\":null},{\"shape\":\"circle\",\"color\":\"#dedeff\",\"id\":\"D\",\"urlLink\":\"\",\"name\":\"D\",\"nodeTooltipHtmlContent\":\"\",\"borderWidth\":1,\"barplotTexts\":[\"\"],\"barplotValues\":[0],\"barplotColors\":[\"#FFFFFF\"],\"starplotValues\":null,\"starplotColors\":null,\"starplotLabels\":null,\"starplotTooltips\":null,\"starplotUrlLinks\":null,\"starplotSectorStartRad\":[],\"starplotCircleFillColor\":[],\"starplotCircleFillOpacity\":[],\"x\":null,\"y\":null,\"fixed\":null},{\"shape\":\"lozenge\",\"color\":\"#dedeff\",\"id\":\"E\",\"urlLink\":\"\",\"name\":\"E\",\"nodeTooltipHtmlContent\":\"\",\"borderWidth\":1,\"barplotTexts\":[\"\"],\"barplotValues\":[0],\"barplotColors\":[\"#FFFFFF\"],\"starplotValues\":null,\"starplotColors\":null,\"starplotLabels\":null,\"starplotTooltips\":null,\"starplotUrlLinks\":null,\"starplotSectorStartRad\":[],\"starplotCircleFillColor\":[],\"starplotCircleFillOpacity\":[],\"x\":null,\"y\":null,\"fixed\":null}],\"links\":[{\"color\":\"#5555ff\",\"source\":0,\"direction\":\"->\",\"target\":1,\"width\":2,\"linkTooltipHtmlContent\":\"\"},{\"color\":\"#5555ff\",\"source\":1,\"direction\":\"-|\",\"target\":3,\"width\":1,\"linkTooltipHtmlContent\":\"\"},{\"color\":\"#5555ff\",\"source\":1,\"direction\":\"->\",\"target\":4,\"width\":1,\"linkTooltipHtmlContent\":\"\"},{\"color\":\"#5555ff\",\"source\":2,\"direction\":\"->\",\"target\":0,\"width\":2,\"linkTooltipHtmlContent\":\"\"}]}"
Warning messages:
1: In nl$nodes[i] <- c(nl$nodes[i], list(contrastColors = ndf$name[highlightNodeColorsIdx], :
number of items to replace is not a multiple of replacement length
2: In nl$nodes[i] <- c(nl$nodes[i], list(contrastColors = ndf$name[highlightNodeColorsIdx], :
number of items to replace is not a multiple of replacement length
3: In nl$nodes[i] <- c(nl$nodes[i], list(contrastColors = ndf$name[highlightNodeColorsIdx], :
number of items to replace is not a multiple of replacement length
4: In nl$nodes[i] <- c(nl$nodes[i], list(contrastColors = ndf$name[highlightNodeColorsIdx], :
number of items to replace is not a multiple of replacement length
5: In nl$nodes[i] <- c(nl$nodes[i], list(contrastColors = ndf$name[highlightNodeColorsIdx], :
number of items to replace is not a multiple of replacement length
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.