Skip to content

Instantly share code, notes, and snippets.

@rvenugopal
Created October 19, 2012 15:41
Show Gist options
  • Save rvenugopal/3918930 to your computer and use it in GitHub Desktop.
Save rvenugopal/3918930 to your computer and use it in GitHub Desktop.
just another inlet to tributary
{"endpoint":"","display":"svg","public":true,"require":[],"tab":"edit","display_percent":0.5195376584638328,"play":false,"loop":false,"restart":false,"autoinit":true,"pause":true,"loop_type":"period","bv":false,"nclones":15,"clone_opacity":0.4,"duration":3000,"ease":"linear","dt":0.01}
var myData = {
text : 'Asia trip',
c2p : null,
level : 1,
children : [
{
text : 'Taiwan',
c2p : 'Gotta have a good time',
level : 2,
children : [
{
text : 'Taipei',
c2p : 'City living',
level : 3,
},
{
text : 'Taroka gorge',
c2p : 'Nice views',
level : 3,
}]
},
{
text : 'Thailand',
c2p : 'Sunny beaches',
level : 2,
children : [
{
text : 'Bangkok',
c2p : 'City Center',
level : 3,
},
{
text : 'Chiang Mai',
c2p : 'Nice treks',
level : 3,
}]
},
{
text : 'India',
c2p : 'Historical',
level : 2,
}
]
}
var myData = {
text : 'Asia trip',
c2p : null,
level : 1,
children : [
{
text : 'Taiwan',
c2p : 'Gotta have a good time',
level : 2,
children : [
{
text : 'Taipei',
c2p : 'City living',
level : 3,
},
{
text : 'Taroka gorge',
c2p : 'Nice views',
level : 3,
}]
},
{
text : 'Thailand',
c2p : 'Sunny beaches',
level : 2,
children : [
{
text : 'Bangkok',
c2p : 'City Center',
level : 3,
},
{
text : 'Chiang Mai',
c2p : 'Nice treks',
level : 3,
}]
},
{
text : 'India',
c2p : 'Historical',
level : 2,
}
]
}
console.log(myData);
var width = 960,
height = 2200,
radius = 400;
var tree = d3.layout.tree()
.size([height, width - 160])
.separation(function(a, b) {
return (a.chidlren == b.children ? 1 : 2) / a.depth;
});
var diagonal = d3.svg.diagonal.radial()
.projection(function(d)
{
return [d.y, d.x / 180 * Math.PI];
});
var vis = d3.select("#display").append("svg")
.attr("width", width)
.attr("height", height)
.append("g")
.attr("transform", "translate(" + radius + "," + radius + ")");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment