r - rCharts Sankey Diagram not plotting -
using code demo demo2 unable view plot. using rstudio , see in "viewer" window url
http://timelyportfoli.github.ip/rcharts_d3_sankey//layouts/chart.html
i must doing wrong, not getting errors or warnings, , cannot find solution.
require(rcharts) require(plyr) gallery <- read.csv( "https://docs.google.com/spreadsheet/pub?key=0aovonzjt5getdehqvdgyyxpjmnz2m2j2ymtvx0i5snc&output=csv", stringsasfactors = false ) gallery.use <- gallery[,c("technology","visualizationtype","documenttype","author")] colnames(gallery.use) <- rep("column",4) gallery.edge <- rbind( gallery.use[,1:2], gallery.use[,2:3], gallery.use[,3:4], deparse.level=1 ) colnames(gallery.edge) <- c("source","target") gallery.edge <- ddply(gallery.edge,~source+target,nrow) colnames(gallery.edge) <- c("source","target","value") #verify no source = target #or stuck in infinite loop gallery.edge[which(gallery.edge[,1]==gallery.edge[,2]),] gallery.edge$source <- as.character(gallery.edge$source) gallery.edge$target <- as.character(gallery.edge$target) sankeyplot2 <- rcharts$new() sankeyplot2$setlib('http://timelyportfolio.github.io/rcharts_d3_sankey/') sankeyplot2$set( data = gallery.edge, nodewidth = 15, nodepadding = 10, layout = 32, width = 960, height = 500 ) sankeyplot2$settemplate( afterscript = " <script> // specific in case have more 1 chart d3.selectall('#{{ chartid }} svg path.link') .style('stroke', function(d){ //here use source color //if want target sub target source //or if want other gray //supply constant //or use categorical scale or gradient return d.source.color; }) //note no changes made opacity //to uncomment below affect mouseover //so need define mouseover , mouseout //happy show how // .style('stroke-opacity', .7) </script> ") sankeyplot2
solved issue. package installed incorrectly.
Comments
Post a Comment