Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
TEP-QuickWin tree
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<style>
circle.dataset {
fill: white;
}
circle.ifg {
fill: red;
}
circle.timeseries {
fill: blue;
}
.link {
fill: none;
stroke: #666;
stroke-width: 1.5px;
}
#slc {
fill: green;
}
.link.slc {
stroke: green;
}
#roipac2doris {
fill: orange;
}
.link.roipac2doris {
stroke: orange;
}
#ifg {
fill: red;
}
.link.ifg {
stroke: red;
}
#timeseries {
fill: blue;
}
.link.timeseries {
stroke: blue;
}
.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: 0 1px 0 #fff, 1px 0 0 #fff, 0 -1px 0 #fff, -1px 0 0 #fff;
}
</style>
<script src="http://d3js.org/d3.v3.min.js"></script>
</head>
<body>
<script>
function removeSpaces(str){
return str.replace(/ /g, '_');
}
// http://blog.thomsonreuters.com/index.php/mobile-patent-suits-graphic-of-the-day/
var links = [
// SLC processing
{source: "ERS1/2 SAR Level 0", target: "ROI_PAC SLC", type: "slc"},
{source: "ERS1/2 SAR Level 0", target: "GMTSAR SLC", type: "slc"},
{source: "ERS1/2 SAR Level 0", target: "PF-ERS SLC", type: "slc"},
{source: "ERS1/2 SAR Level 0", target: "SBAS SLC", type: "slc"},
{source: "Envisat ASAR Level 0", target: "GMTSAR SLC", type: "slc"},
{source: "Envisat ASAR Level 0", target: "PF-ASAR SLC", type: "slc"},
{source: "Envisat ASAR Level 0", target: "ROI_PAC SLC", type: "slc"},
{source: "Envisat ASAR Level 0", target: "SBAS SLC", type: "slc"},
{source: "Radarsat-2 SLC", target: "ROI_PAC SLC", type: "slc"},
//ROI_PAC2Doris
{source: "ROI_PAC SLC", target: "roipac2doris", type: "roipac2doris"},
// ifg processing
{source: "ROI_PAC SLC", target: "ROI_PAC ifg", type: "ifg"},
{source: "roipac2doris", target: "Doris", type: "ifg"},
{source: "PF-ASAR SLC", target: "Doris", type: "ifg"},
{source: "PF-ERS SLC", target: "Doris", type: "ifg"},
{source: "Envisat ASAR Level 1", target: "Doris", type: "ifg"},
{source: "Radarsat-2 SLC", target: "Doris", type: "ifg"},
{source: "GMTSAR SLC", target: "GMTSAR ifg", type: "ifg"},
{source: "DLR TerraSAR-X SLC", target: "Doris", type: "ifg"},
{source: "DLR TerraSAR-X SLC", target: "ROI_PAC ifg", type: "ifg"},
{source: "ASI CSK SLC", target: "Doris", type: "ifg"},
{source: "ASI CSK SLC", target: "ROI_PAC ifg", type: "ifg"},
{source: "SBAS SLC", target: "SBAS ifg", type: "ifg"},
{source: "Sentinel-1A SLC", target: "SBAS ifg", type: "ifg"},
// time series
{source: "ROI_PAC ifg", target: "GIAnT", type: "timeseries"},
{source: "GMTSAR ifg", target: "GIAnT", type: "timeseries"},
{source: "Doris", target: "GIAnT", type: "timeseries"},
{source: "Doris", target: "StaMPS", type: "timeseries"},
{source: "SBAS ifg", target: "SBAS", type: "timeseries"},
//{source: "Envisat ASAR Level 0", target: "ROI_PAC", type: "slc"},
//{source: "Envisat ASAR Level 1", target: "Doris", type: "slc"},
//{source: "GMTSAR", target: "GIAnT", type: "slc"},
//{source: "ROI_PAC", target: "GIAnT", type: "ifg"},
//{source: "ROI_PAC", target: "ROI_PAC2doris", type: "suit"},
//{source: "ROI_PAC2doris", target: "Doris", type: "suit"},
//{source: "Doris", target: "GIAnT", type: "resolved"},
//{source: "Doris", target: "StaMPS", type: "resolved"},
//{source: "Sentinel-1A", target: "SBAS", type: "suit"},
];
var nodeTypes = {
"ERS1/2 SAR Level 0": 'dataset',
"Envisat ASAR Level 0": 'dataset',
"Envisat ASAR Level 1": 'dataset',
"DLR TerraSAR-X SLC": 'dataset',
"ASI CSK SLC": 'dataset',
"Radarsat-2 SLC": 'dataset',
"ROI_PAC SLC": 'type1',
"GMTSAR SLC": 'type1',
"PF-ERS SLC": 'type2',
"PF-ASAR SLC": 'type2',
"SBAS SLC": 'type2',
"Envisat ASAR Level 0": 'type2',
"SBAS SLC": 'type2',
"ROI_PAC SLC": 'type2',
"Doris": 'ifg',
"GMTSAR ifg": 'ifg',
"GIAnT": 'timeseries',
"StaMPS": 'timeseries',
};
var nodeStylesMapping = {
dataset: { r: 20 },
ifg: { r: 15 },
timeseries: { r: 20 },
}
var nodes = {};
// Compute the distinct nodes from the links.
links.forEach(function(link) {
link.source = nodes[link.source] || (nodes[link.source] = {name: link.source, nodeType: nodeTypes[link.source]});
link.target = nodes[link.target] || (nodes[link.target] = {name: link.target, nodeType: nodeTypes[link.target]});
});
var width = 960,
height = 800;
var force = d3.layout.force()
.nodes(d3.values(nodes))
.links(links)
.size([width, height])
.linkDistance(150)
.charge(-1000)
.on("tick", tick)
.start();
var svg = d3.select("body").append("svg")
.attr("width", width)
.attr("height", height);
// Per-type markers, as they don't inherit styles.
svg.append("defs").selectAll("marker")
.data(["slc", "ifg", "timeseries", "roipac2doris"])
.enter().append("marker")
.attr("id", function(d) { return d; })
.attr("viewBox", "0 -5 10 10")
.attr("refX", 15)
.attr("refY", -1.5)
.attr("markerWidth", 10)
.attr("markerHeight", 10)
.attr("orient", "auto")
.append("path")
.attr("d", "M0,-5L10,0L0,5");
var path = svg.append("g").selectAll("path")
.data(force.links())
.enter().append("path")
.attr("class", function(d) { return "link " + d.type; })
.attr("marker-end", function(d) { return "url(#" + d.type + ")"; });
var circle = svg.append("g").selectAll("circle")
.data(force.nodes())
.enter().append("circle")
.attr("r", function(n){return nodeStylesMapping[n.nodeType] ? nodeStylesMapping[n.nodeType].r : 6 })
.attr("class", function(n){return n.nodeType})
.call(force.drag);
var text = svg.append("g").selectAll("text")
.data(force.nodes())
.enter().append("text")
.attr("x", function(n){return nodeStylesMapping[n.nodeType] ? nodeStylesMapping[n.nodeType].r+2 : 8 })
.attr("y", ".31em")
.text(function(d) { return d.name; });
// Use elliptical arc path segments to doubly-encode directionality.
function tick() {
path.attr("d", linkArc);
circle.attr("transform", transform);
text.attr("transform", transform);
}
function linkArc(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;
}
function transform(d) {
return "translate(" + d.x + "," + d.y + ")";
}
</script>
TEP-QuickWin product tree
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.