I am trying to implement this sankey example: http://bl.ocks.org/d3noob/c9b90689c1438f57d649
It uses a CSV file for data input with the fields:
source - target - value
The link title is displayed as:
I would like to add another field to the data input:
source - target - value - information
Which should be added to the link title as follows:
Do you see a way to add this information? I tried changing:
<!-- language: lang-js -->
// load the data (using the timelyportfolio csv method)
d3.csv("sankey.csv", function(error, data) {
//set up graph in same style as original example but empty
graph = {"nodes" : [], "links" : []};
data.forEach(function (d) {
graph.nodes.push({ "name": d.source });
graph.nodes.push({ "name": d.target });
graph.links.push({ "source": d.source,
"target": d.target,
"value": +d.value,
**"information": +d.information**} });
});
// add the link titles
link.append("title")
.text(function(d) {
return d.source.name + " → " +
d.target.name + "\n" + format(d.value) + **d.information**; });
Which is unfortunately not working.