Skip to content

Instantly share code, notes, and snippets.

@antimatter15
Forked from mbostock/.block
Created December 17, 2012 07:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save antimatter15/4316393 to your computer and use it in GitHub Desktop.
Save antimatter15/4316393 to your computer and use it in GitHub Desktop.

Click to drag nodes.

BLAH BLAH BLAH BLAH. Stolen from mbostock

Implemented in D3.js.

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Mobile Patent Suits</title>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?1.29.1"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.geom.js?1.29.1"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.layout.js?1.29.1"></script>
<style type="text/css">
path.link {
fill: none;
stroke: #666;
stroke-width: 1.5px;
}
marker#licensing {
fill: green;
}
path.link.licensing {
stroke: green;
}
path.link.resolved {
stroke-dasharray: 0,2 1;
}
circle {
fill: #ccc;
stroke: #333;
stroke-width: 1.5px;
}
text {
font: 10px sans-serif;
pointer-events: none;
}
text.shadow {
stroke: #fff;
stroke-width: 3px;
stroke-opacity: .8;
}
</style>
</head>
<body>
<script type="text/javascript">
// http://blog.thomsonreuters.com/index.php/mobile-patent-suits-graphic-of-the-day/
var links = [
{"source":"Kevin Kwok","target":"Eric Tao","type":"suit"},
{"source":"Gabriel Reilly","target":"Mikayla Murphy","type":"suit"},
{"source":"Alexander Nordin","target":"Tobore Tasker","type":"suit"},
{"source":"Gabriel Reilly","target":"Morgan O'Brien","type":"suit"},
{"source":"Gabriel Reilly","target":"Scout Brisson","type":"suit"},
{"source":"Gabriel Reilly","target":"Ääron Lloyd Morris","type":"suit"},
{"source":"Gabriel Reilly","target":"Spencer Joseph","type":"suit"},
{"source":"Robert Jones","target":"Kevin Kwok","type":"suit"},
{"source":"Gabriel Reilly","target":"Megan Gebhard","type":"suit"},
{"source":"Gabriel Reilly","target":"Saarik Kalia","type":"suit"},
{"source":"Gabriel Reilly","target":"Zain Raza","type":"suit"},
{"source":"Gabriel Reilly","target":"Maria Stoica","type":"suit"},
{"source":"Gabriel Reilly","target":"Tucker Cheyne","type":"suit"},
{"source":"Gabriel Reilly","target":"Bimal Yadav","type":"suit"},
{"source":"Gabriel Reilly","target":"Elena Byun","type":"suit"},
{"source":"Gabriel Reilly","target":"Leo Calderas","type":"suit"},
{"source":"Gabriel Reilly","target":"Ian Hill","type":"suit"},
{"source":"Gabriel Reilly","target":"Julia Wu","type":"suit"},
{"source":"Gabriel Reilly","target":"Miguel Rodriguez","type":"suit"},
{"source":"Paul Windsor Kalebu","target":"Jake Hecla","type":"suit"},
{"source":"Runpeng Liu","target":"Bobby Shen","type":"suit"},
{"source":"Gabriel Reilly","target":"Marcus Boorstin","type":"suit"},
{"source":"Gabriel Reilly","target":"Crystal Pan","type":"suit"},
{"source":"Gabriel Reilly","target":"Lily Zhou","type":"suit"},
{"source":"Gabriel Reilly","target":"Julia Kudryashev","type":"suit"},
{"source":"Gabriel Reilly","target":"Harris Stolz","type":"suit"},
{"source":"Gabriel Reilly","target":"Colin Aitken","type":"suit"},
{"source":"Gabriel Reilly","target":"Runpeng Liu","type":"suit"},
{"source":"Gabriel Reilly","target":"Jorge Garcia","type":"suit"},
{"source":"Gabriel Reilly","target":"Zach Izzo","type":"suit"},
{"source":"Caroline Walsh","target":"Liam Cohen","type":"suit"},
{"source":"Gabriel Reilly","target":"Hao Shen","type":"suit"},
{"source":"Gabriel Reilly","target":"Brianna Berry Os","type":"suit"},
{"source":"Skyler Adams","target":"Kristina Bennett","type":"suit"},
{"source":"Aish Narayan","target":"Joey Valle","type":"suit"},
{"source":"Skyler Adams","target":"Justin Bader","type":"suit"},
{"source":"Skyler Adams","target":"Ryland Dreibelbis","type":"suit"},
{"source":"Gabriel Reilly","target":"Gabriella del Hierro","type":"suit"},
{"source":"Gabriel Reilly","target":"Katherine Wu","type":"suit"},
{"source":"Gabriel Reilly","target":"Amanda Grace Wall","type":"suit"},
{"source":"Gabriel Reilly","target":"Lauren Ullmann","type":"suit"},
{"source":"Gabriel Reilly","target":"Tim Manganello","type":"suit"},
{"source":"Gabriel Reilly","target":"Kristina Elizabeth","type":"suit"},
{"source":"Gabriel Reilly","target":"Katherine Whang","type":"suit"},
{"source":"Gabriel Reilly","target":"Diego Huyke","type":"suit"},
{"source":"Jay Raju","target":"Amaal Mustafa","type":"suit"},
{"source":"Jay Raju","target":"Brian Erickson","type":"suit"},
{"source":"Gabriel Reilly","target":"Jay Raju","type":"suit"},
{"source":"Angus Lai","target":"Saumil Bandyopadhyay","type":"suit"},
{"source":"Angus Lai","target":"Nalini Singh","type":"suit"},
{"source":"Gabriel Reilly","target":"Rose Robb","type":"suit"},
{"source":"Gabriel Reilly","target":"Kiran Wattamwar","type":"suit"},
{"source":"Gabriel Reilly","target":"Pavlina Karafillis","type":"suit"},
{"source":"Gabriel Reilly","target":"Lucia Lam","type":"suit"},
{"source":"Gabriel Reilly","target":"Akash Kumar Parida","type":"suit"},
{"source":"Gabriel Reilly","target":"Jade Diane","type":"suit"},
{"source":"Gabriel Reilly","target":"Henry Tareque","type":"suit"},
{"source":"Gabriel Reilly","target":"Crystal Cockerill","type":"suit"},
{"source":"Gabriel Reilly","target":"Orlando Santos Ward","type":"suit"},
{"source":"Gabriel Reilly","target":"Reece Tamashiro","type":"suit"},
{"source":"Gabriel Reilly","target":"Emily Armstrong","type":"suit"},
{"source":"Gabriel Reilly","target":"Niki Tubacki","type":"suit"},
{"source":"Gabriel Reilly","target":"Meghana Bhat","type":"suit"},
{"source":"Gabriel Reilly","target":"Derek Salvucci","type":"suit"},
{"source":"Gabriel Reilly","target":"Brittany S. Pierce","type":"suit"},
{"source":"Gabriel Reilly","target":"Pooja Sethi","type":"suit"},
{"source":"Gabriel Reilly","target":"Charissa Juliet Plattner","type":"suit"},
{"source":"Gabriel Reilly","target":"Sabrine Ahmed-Iqbal","type":"suit"},
{"source":"Gabriel Reilly","target":"Preksha Naik","type":"suit"},
{"source":"Gabriel Reilly","target":"Nathan Hernandez","type":"suit"},
{"source":"Gabriel Reilly","target":"Brenda Stern","type":"suit"},
{"source":"Gabriel Reilly","target":"Helen Melon","type":"suit"},
{"source":"Gabriel Reilly","target":"Eric Fegan","type":"suit"},
{"source":"Gabriel Reilly","target":"Jacob Neis","type":"suit"},
{"source":"Gabriel Reilly","target":"Jason Liang","type":"suit"},
{"source":"Gabriel Reilly","target":"Laura Gustafson","type":"suit"},
{"source":"Connor Duffy","target":"Allan Ko","type":"suit"},
{"source":"Gabriel Reilly","target":"Erick Pinos","type":"suit"},
{"source":"Gabriel Reilly","target":"Landon Carter","type":"suit"},
{"source":"Connor Duffy","target":"Bennett Amodio","type":"suit"},
{"source":"Connor Duffy","target":"Aradhana Sinha","type":"suit"},
{"source":"Connor Duffy","target":"Robert Jones","type":"suit"},
{"source":"Gabriel Reilly","target":"Miranda Kotidis","type":"suit"},
{"source":"Gabriel Reilly","target":"Wen Zeng","type":"suit"},
{"source":"Gabriel Reilly","target":"Hannah Mc","type":"suit"},
{"source":"Donald Little","target":"Stephen Chen","type":"suit"},
{"source":"Gabriel Reilly","target":"Grace Li","type":"suit"},
{"source":"Gabriel Reilly","target":"Ben Claman","type":"suit"},
{"source":"Gabriel Reilly","target":"Connor Duffy","type":"suit"},
{"source":"Gabriel Reilly","target":"Ian Perry","type":"suit"},
{"source":"Shelby Pefley","target":"Hongyi Shi","type":"suit"},
{"source":"Donald Little","target":"Gabi Baracchini","type":"suit"},
{"source":"Donald Little","target":"Jennifer Yu","type":"suit"},
{"source":"Gabriel Reilly","target":"Kareem Itani","type":"suit"},
{"source":"Gabriel Reilly","target":"Michelle Chao","type":"suit"},
{"source":"Gabriel Reilly","target":"Eric Anschütz","type":"suit"},
{"source":"Anish Athalye","target":"Surya Bhupatiraju","type":"suit"},
{"source":"Gabriel Reilly","target":"David Perera","type":"suit"},
{"source":"Gabriel Reilly","target":"Alexander Nordin","type":"suit"},
{"source":"Gabriel Reilly","target":"Rachel Rotteveel","type":"suit"},
{"source":"Ikechi Akujobi","target":"Anni Zhang","type":"suit"},
{"source":"Ikechi Akujobi","target":"Jin Yoon","type":"suit"},
{"source":"Gabriel Reilly","target":"Hadrick Green","type":"suit"},
{"source":"Gabriel Reilly","target":"Weston Braun","type":"suit"},
{"source":"Gabriel Reilly","target":"Rosemond Row-Zay Dorleans","type":"suit"},
{"source":"Gabriel Reilly","target":"Tally Portnoi","type":"suit"},
{"source":"Gabriel Reilly","target":"Yiwei Luo","type":"suit"},
{"source":"Gabriel Reilly","target":"Lawrence Wu","type":"suit"},
{"source":"Gabriel Reilly","target":"Mina Blume","type":"suit"},
{"source":"Gabriel Reilly","target":"Ruqayya Toorawa","type":"suit"},
{"source":"Gabriel Reilly","target":"Aaron Hammond","type":"suit"},
{"source":"Gabriel Reilly","target":"Ikechi Akujobi","type":"suit"},
{"source":"Gabriel Reilly","target":"Diego Earthh","type":"suit"},
{"source":"Gabriel Reilly","target":"Thanhthanh Maria Lai","type":"suit"},
{"source":"Gabriel Reilly","target":"Kali Rosendo","type":"suit"},
{"source":"Gabriel Reilly","target":"Jimmie Harris","type":"suit"},
{"source":"Gabriel Reilly","target":"Miguel Medrano","type":"suit"},
{"source":"Gabriel Reilly","target":"Wei Low","type":"suit"},
{"source":"Gabriel Reilly","target":"Olivia Makepeace","type":"suit"},
{"source":"Gabriel Reilly","target":"Abraham Quintero","type":"suit"},
{"source":"Gabriel Reilly","target":"Justin Xiao","type":"suit"},
{"source":"Gabriel Reilly","target":"Tori Wuthrich","type":"suit"},
{"source":"Gabriel Reilly","target":"Andres Alvarez","type":"suit"},
{"source":"Alex Souvannakhot","target":"Narindra Peaks","type":"suit"},
{"source":"Angus Lai","target":"Gil Goldshlager","type":"suit"},
{"source":"Gabriel Reilly","target":"Isabel Chien","type":"suit"},
{"source":"Gabriel Reilly","target":"Robbie Romero","type":"suit"},
{"source":"Gabriel Reilly","target":"Dylan Blake","type":"suit"},
{"source":"Gabriel Reilly","target":"Tyson Yi Chen","type":"suit"},
{"source":"Gabriel Reilly","target":"Jake McNamara","type":"suit"},
{"source":"Gabriel Reilly","target":"Matt Danger Stringfellow","type":"suit"},
{"source":"Gabriel Reilly","target":"Suzy Mueller","type":"suit"},
{"source":"Charles Bello","target":"Sebastián Toro Arana","type":"suit"},
{"source":"Gabriel Reilly","target":"Corey Walsh","type":"suit"},
{"source":"Gabriel Reilly","target":"Orlando Arevalo","type":"suit"},
{"source":"Gabriel Reilly","target":"Sina Booeshaghi","type":"suit"},
{"source":"Angus Lai","target":"Connor Popik","type":"suit"},
{"source":"Angus Lai","target":"Hernando De Ace","type":"suit"},
{"source":"Gabriel Reilly","target":"Yashaswini Chittampalli","type":"suit"},
{"source":"Gabriel Reilly","target":"Haohang Xu","type":"suit"},
{"source":"Gabriel Reilly","target":"Wendy Tsai","type":"suit"},
{"source":"Gabriel Reilly","target":"Paul Windsor Kalebu","type":"suit"},
{"source":"Vineel Adusumilli","target":"Brian Axelrod","type":"suit"},
{"source":"Gabriel Reilly","target":"Shelby Pefley","type":"suit"},
{"source":"Jack Brown","target":"Vardaan Gurung","type":"suit"},
{"source":"Gabriel Reilly","target":"Alex Souvannakhot","type":"suit"},
{"source":"Gabriel Reilly","target":"Victoria Dean","type":"suit"},
{"source":"Gabriel Reilly","target":"Vineel Adusumilli","type":"suit"},
{"source":"Gabriel Reilly","target":"Anvita Pandit","type":"suit"},
{"source":"Angus Lai","target":"Sara Volz","type":"suit"},
{"source":"Gabriel Reilly","target":"Fernando Trujano","type":"suit"},
{"source":"Gabriel Reilly","target":"Elizabeth Rider","type":"suit"},
{"source":"Gabriel Reilly","target":"Corey Alexander Cleveland","type":"suit"},
{"source":"Gabriel Reilly","target":"Faith Epic Huynh","type":"suit"},
{"source":"Gabriel Reilly","target":"Jose Cirilo","type":"suit"},
{"source":"Gabriel Reilly","target":"Raivo Andrian","type":"suit"},
{"source":"Gabriel Reilly","target":"Emily Giurleo","type":"suit"},
{"source":"Gabriel Reilly","target":"Victoria Gregory","type":"suit"},
{"source":"Gabriel Reilly","target":"Adam Zionts","type":"suit"},
{"source":"Gabriel Reilly","target":"Sade Nabahe","type":"suit"},
{"source":"Gabriel Reilly","target":"Diana Hernandez","type":"suit"},
{"source":"Gabriel Reilly","target":"Gene Woo Kang","type":"suit"},
{"source":"Gabriel Reilly","target":"Alberto J.L. Mulero Fernandez","type":"suit"},
{"source":"Gabriel Reilly","target":"Max Haubenstock","type":"suit"},
{"source":"Gabriel Reilly","target":"Tanner Guerra","type":"suit"},
{"source":"Gabriel Reilly","target":"Chheangkea Ieng","type":"suit"},
{"source":"Gabriel Reilly","target":"Jessica Qian","type":"suit"},
{"source":"Gabriel Reilly","target":"Becky Bell","type":"suit"},
{"source":"Gabriel Reilly","target":"Jasmeet Arora","type":"suit"},
{"source":"Angus Lai","target":"James Rowan","type":"suit"},
{"source":"Gabriel Reilly","target":"Cali Callaway","type":"suit"},
{"source":"Gabriel Reilly","target":"Jack Brown","type":"suit"},
{"source":"Gabriel Reilly","target":"Rudy Garcia","type":"suit"},
{"source":"Gabriel Reilly","target":"Daniel Ziegler","type":"suit"},
{"source":"Gabriel Reilly","target":"Vivian Wang","type":"suit"},
{"source":"Gabriel Reilly","target":"Dang Pham","type":"suit"},
{"source":"Gabriel Reilly","target":"Christine Konicki","type":"suit"},
{"source":"Gabriel Reilly","target":"Lambertghini Mercy","type":"suit"},
{"source":"Gabriel Reilly","target":"Priscilla Agosto","type":"suit"},
{"source":"Gabriel Reilly","target":"Lindsey Wattley","type":"suit"},
{"source":"Gabriel Reilly","target":"Janaya Shelly","type":"suit"},
{"source":"Gabriel Reilly","target":"Katie Silva","type":"suit"},
{"source":"Gabriel Reilly","target":"Gustavo Montalvo","type":"suit"},
{"source":"Gabriel Reilly","target":"Phillip Graham","type":"suit"},
{"source":"Gabriel Reilly","target":"Julia Huang","type":"suit"},
{"source":"Gabriel Reilly","target":"Anuj Khandelwal","type":"suit"},
{"source":"Gabriel Reilly","target":"Giselle Gomez","type":"suit"},
{"source":"Gabriel Reilly","target":"Jonatan Yucra","type":"suit"},
{"source":"Aish Narayan","target":"Bryan Cai","type":"suit"},
{"source":"Gabriel Reilly","target":"Frederick Daso","type":"suit"},
{"source":"Gabriel Reilly","target":"Anish Athalye","type":"suit"},
{"source":"Gabriel Reilly","target":"Asra Ali","type":"suit"},
{"source":"Gabriel Reilly","target":"Roberto Brenes","type":"suit"},
{"source":"Angus Lai","target":"Kate Farris","type":"suit"},
{"source":"Gabriel Reilly","target":"Brian Steven Saavedra","type":"suit"},
{"source":"Gabriel Reilly","target":"Marika Svolos","type":"suit"},
{"source":"Gabriel Reilly","target":"Brandon Carter","type":"suit"},
{"source":"Gabriel Reilly","target":"Andres Hernandez","type":"suit"},
{"source":"Gabriel Reilly","target":"Victor Zhang","type":"suit"},
{"source":"Gabriel Reilly","target":"Annie Phan","type":"suit"},
{"source":"Gabriel Reilly","target":"Alyssa Smith","type":"suit"},
{"source":"Gabriel Reilly","target":"Isabella Espinel","type":"suit"},
{"source":"Gabriel Reilly","target":"Aish Narayan","type":"suit"},
{"source":"Angus Lai","target":"Raine Hasskew","type":"suit"},
{"source":"Gabriel Reilly","target":"Cordelia Tuan","type":"suit"},
{"source":"Gabriel Reilly","target":"Logan Abel","type":"suit"},
{"source":"Angus Lai","target":"Descartes Holland","type":"suit"},
{"source":"Angus Lai","target":"Cesar Reynosa","type":"suit"},
{"source":"Angus Lai","target":"Eugene Chen","type":"suit"},
{"source":"Angus Lai","target":"Ray Li","type":"suit"},
{"source":"Angus Lai","target":"Katherine Mizrahi","type":"suit"},
{"source":"Angus Lai","target":"Cyril Creque-Sarbinowski","type":"suit"},
{"source":"Angus Lai","target":"Maximillian Major","type":"suit"},
{"source":"Angus Lai","target":"Julia Belk","type":"suit"},
{"source":"Angus Lai","target":"Becky Steinmeyer","type":"suit"},
{"source":"Angus Lai","target":"Daniela Zúñiga Sacks","type":"suit"},
{"source":"Angus Lai","target":"Dorothy Chen","type":"suit"},
{"source":"Gabriel Reilly","target":"Bob Liang","type":"suit"},
{"source":"Gabriel Reilly","target":"Arthi Narayanan","type":"suit"},
{"source":"Gabriel Reilly","target":"Caroline Walsh","type":"suit"},
{"source":"Gabriel Reilly","target":"Lilian Benet","type":"suit"},
{"source":"Gabriel Reilly","target":"Victor Wang","type":"suit"},
{"source":"Gabriel Reilly","target":"Armando Fadhel","type":"suit"},
{"source":"Gabriel Reilly","target":"Courtney Suhyun Noh","type":"suit"},
{"source":"Angus Lai","target":"Brandon Axe","type":"suit"},
{"source":"Gabriel Reilly","target":"Adriana Arata","type":"suit"},
{"source":"Gabriel Reilly","target":"Sravya Vishnubhatla","type":"suit"},
{"source":"Gabriel Reilly","target":"Dani Elle","type":"suit"},
{"source":"Gabriel Reilly","target":"Obasi Onuoha","type":"suit"},
{"source":"Gabriel Reilly","target":"Andrés Náter","type":"suit"},
{"source":"Gabriel Reilly","target":"Carolina Fejgielman","type":"suit"},
{"source":"Gabriel Reilly","target":"Charles Bello","type":"suit"},
{"source":"Gabriel Reilly","target":"Ben Kompa","type":"suit"},
{"source":"Gabriel Reilly","target":"Marcos Pertierra","type":"suit"},
{"source":"Gabriel Reilly","target":"Michael Cheung","type":"suit"},
{"source":"Gabriel Reilly","target":"Paola M. Perez","type":"suit"},
{"source":"Gabriel Reilly","target":"Suri Bandler","type":"suit"},
{"source":"Gabriel Reilly","target":"Francesca Schembri","type":"suit"},
{"source":"Gabriel Reilly","target":"Skyler Adams","type":"suit"},
{"source":"Gabriel Reilly","target":"Angus Lai","type":"suit"},
{"source":"Gabriel Reilly","target":"Haley B-E","type":"suit"},
{"source":"Gabriel Reilly","target":"Angel Yu","type":"suit"},
{"source":"Gabriel Reilly","target":"Rachel Nations","type":"suit"},
{"source":"Donald Little","target":"Gabriel Reilly","type":"suit"},
{"source":"Donald Little","target":"Anish Punjabi","type":"suit"}
];
var nodes = {};
// Compute the distinct nodes from the links.
links.forEach(function(link) {
link.source = nodes[link.source] || (nodes[link.source] = {name: link.source});
link.target = nodes[link.target] || (nodes[link.target] = {name: link.target});
});
var w = 960,
h = 500;
var force = d3.layout.force()
.nodes(d3.values(nodes))
.links(links)
.size([w, h])
.linkDistance(60)
.charge(-300)
.on("tick", tick)
.start();
var svg = d3.select("body").append("svg:svg")
.attr("width", w)
.attr("height", h);
// Per-type markers, as they don't inherit styles.
svg.append("svg:defs").selectAll("marker")
.data(["suit", "licensing", "resolved"])
.enter().append("svg:marker")
.attr("id", String)
.attr("viewBox", "0 -5 10 10")
.attr("refX", 15)
.attr("refY", -1.5)
.attr("markerWidth", 6)
.attr("markerHeight", 6)
.attr("orient", "auto")
.append("svg:path")
.attr("d", "M0,-5L10,0L0,5");
var path = svg.append("svg:g").selectAll("path")
.data(force.links())
.enter().append("svg:path")
.attr("class", function(d) { return "link " + d.type; })
.attr("marker-end", function(d) { return "url(#" + d.type + ")"; });
var circle = svg.append("svg:g").selectAll("circle")
.data(force.nodes())
.enter().append("svg:circle")
.attr("r", 6)
.call(force.drag);
var text = svg.append("svg:g").selectAll("g")
.data(force.nodes())
.enter().append("svg:g");
// A copy of the text with a thick white stroke for legibility.
text.append("svg:text")
.attr("x", 8)
.attr("y", ".31em")
.attr("class", "shadow")
.text(function(d) { return d.name; });
text.append("svg:text")
.attr("x", 8)
.attr("y", ".31em")
.text(function(d) { return d.name; });
// Use elliptical arc path segments to doubly-encode directionality.
function tick() {
path.attr("d", function(d) {
var dx = d.target.x - d.source.x,
dy = d.target.y - d.source.y,
dr = Math.sqrt(dx * dx + dy * dy);
return "M" + d.source.x + "," + d.source.y + "A" + dr + "," + dr + " 0 0,1 " + d.target.x + "," + d.target.y;
});
circle.attr("transform", function(d) {
return "translate(" + d.x + "," + d.y + ")";
});
text.attr("transform", function(d) {
return "translate(" + d.x + "," + d.y + ")";
});
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment