python - Adding another line to chord chart arc title from different source in d3 -
i'm relatively new d3 , still trying wrap head around how data sets link together. simplicity sake, using this beautiful chord chart mike bostock base design.
i've created 35x35 matrix of fake data, variable defined "corr":
in python
corr = pandas.dataframe(randn(35,35))
placed in script
var corr = [[...], [...], [...], . . ., [...]];
in script, title chunk is:
chord.append("title").text(function(d) { return " " + cities[d.target.index].name + " → " + cities[d.source.index].name + ": " + formatpercent(d.source.value) + "\n " + cities[d.source.index].name + " → " + cities[d.target.index].name + ": " + formatpercent(d.target.value); });
i think problem trying call different data set, regardless, of approaches end in chord chart or titles not appearing.
any , advice appreciated!
what defining 'cities' as? example loads this csv array of objects:
d3.csv("cities.csv", function(cities) {
since don't have city names, function creates title text crashes instead of returning creating title.
i recommend using index number in titles:
chord.append("title").text(function(d) { return " " + d.target.index + " → " + d.source.index + ": " + formatpercent(d.source.value) + "\n " + d.source.index + " → " + d.target.index + ": " + formatpercent(d.target.value); });
if can't work, should post (http://bl.ocks.org/ or http://jsfiddle.net/) you've done far; hard guess might going wrong.
Comments
Post a Comment