Skip to main content
100%

color your d3 sankey using rCharts

✓ Published0🌍 Public
AAndresAnayaIsaza
Last edited Feb 4, 2017
Created on Feb 4, 2017

This example shows how to add color to a d3.js Sankey diagram built with rCharts, using data from a Google Spreadsheet describing visualization gallery entries. The code uses the `d3.sankey` plugin to create the diagram, then applies a custom `afterScript` template that selects all `path.link` elements and sets their stroke color to match the source node’s color. The data is processed with `plyr` to aggregate edges into source-target-value triples. The result is a color-coded Sankey diagram rendered in SVG, demonstrating a technique applicable beyond rCharts.

AI-generated description

How To Color Your d3.js Sankey Diagram

in this case with rCharts but relevant even without

In response to this Stack Overflow question Adding Color to Sankey Diagram in rCharts, I put this quick example together to demonstrate one way of handling.

demo

forked from <a href='http://bl.ocks.org/timelyportfolio/'>timelyportfolio</a>'s block: <a href='http://bl.ocks.org/timelyportfolio/79350d7475a5709b051e'>color your d3 sankey using rCharts</a>

mit Licensed

Similar vizzes