EVE Online: B-R5BR put into context
HTML
<script src="http://d3js.org/d3.v3.min.js"></script>
<h1>EVE Online January 2014 to February 5th 2014</h1>
<h2>Destroyed value by solar system (supercapitals by base value plus killmail)</h2>
<pre id="csvdata">
name,security,value
Amarr,1,337.292997124372
Ammold,1,14.8987662387299
Amsen,1,1.2858878753526
Bourynes,1,3.1357520094542
Chaven,1,13.9373518312565
Cistuvaert,1,4.0775000315143
Duripant,1,1.253321317433
Emrayur,1,2.2212654554431
Hulm,1,1.2661030992963
Kisogo,1,3.303200363882
Luminaire,1,4.0236044450488
New Caldari,1,65.7243846908554
Pator,1,16.1253669277434
Ryddinjorn,1,0.6005590539843
Sarum...
CSS
body {
background: #202020;
font-family: Calibri;
font-size: 12px;
}
h1 {
font-size: 40px;
color: #909090;
margin: 2px;
}
h2 {
font-size: 20px;
color: #707070;
margin: 0px;
}
#csvdata {
display: none;
}
.legendTitle
{
fill: #F0F0F0;
}
.legend
{
fill: #303030;
alpha: 0.5;
}
JavaScript
/*
You may use this code for non-commercial purposes only, on the condition that the following copyright notice is displayed prominently on any page where the code appears:
©2014 CCP hf. EVE Online and the EVE logo are the registered trademarks of CCP hf. All rights are reserved worldwide. All other trademarks are the property of their respective owners. EVE Online, the EVE logo, EVE and all associated logos and designs are the intellectual property of CCP hf. All artwork, screenshots, characters, vehicles, storylines, world facts or other recognizable features of the intellectual property relating to these trademarks are likewise the intellectual property of CCP hf.
*/
function parseForBubble(root)
{
var lst = [];
root.forEach(function(n) { lst.push({value:parseInt(n.value), system:n.name,security:parseFloat(n.security) });});
return {children:lst};
}
function plotBubbles(rootSvg, root) {
var totalValue = d3.sum(root, function(d) {return d.value;});
var valueDisplayLimit = totalValue * 0.005;
var node = rootSvg.selectAll("systems")
.data(bubble.nodes(parseForBubble(root)).filter(function(d) { return !d.children; }))
.enter().append("g")
.attr("class", "node")
.attr("transform", function(d) { return "translate(" + d.x + "," + d.y + ")"; });
//This adds a title which pops up when a mouse cursor hovers over the node
node.append("title")
.text(function(d) { return d.system + "(" + format(d.security) + '): ' + formatLarge(parseInt(d.value)) + " B" });
//The circle-element of the bubble
node.append("circle")
.attr("r", function(d) { return d.r; })
.style("fill", function(d) { return color(d.security); })
.style("stroke", function(d) {return d3.rgb(color(d.security)).darker(); });
//Text element containing the system name, do some truncating magic(shitmix)...
node.append("text")
.attr("dy", "3px")
...