Wars dataset from COW. Each path represents a war and associated circles represent the number of victims. Inspired from Valentina D’Efilippo’s work
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
font: 10px sans-serif;
}
.axis path,
.axis line {
fill: none;
stroke: #000;
shape-rendering: crispEdges;
}
.y.axis line {
stroke: #777;
stroke-dasharray: 2,2;
}
</style>
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"></script>
<script>
var margin = {top: 20, right: 20, bottom: 20, left: 10},
width = 960 - margin.left - margin.right,
height = 500 - margin.top - margin.bottom;
var parseDate = d3.time.format("%m-%d-%Y").parse;
var x = d3.time.scale()
.range([0, width - 50]);
var y = d3.scale.sqrt()
.range([height, 0]);
var r = d3.scale.sqrt()
.range([5, 30]);
var color = d3.scale.quantile()
.range(["#fd8d3c","#fc4e2a","#e31a1c","#bd0026"]);
var xAxis = d3.svg.axis()
.scale(x)
.tickSize(6, 0)
.orient("bottom");
var yAxis = d3.svg.axis()
.scale(y)
.tickSize(30, 0)
.orient("left");
var diag = d3.svg.diagonal()
.source(function(d) { return {x: x(d.start),y: y(0)}; })
.target(function(d) { return {x: x(d.end),y: y(d.duration)}; });
var svg = d3.select("body").append("svg")
.attr("width", width + margin.left + margin.right)
.attr("height", height + margin.top + margin.bottom)
.append("g")
.attr("transform", "translate(" + margin.left + "," + margin.top + ")");
d3.csv("data.csv", function(error, data) {
if (error) throw error;
data.forEach(function(d) {
d.start = parseDate(d.start);
d.end = parseDate(d.end);
d.duration = (d.end - d.start)/(1000*24*60*60*31*12);
d.batDeath = +d.batDeath;
});
data.sort(function(a,b) { return b.batDeath - a.batDeath; });
x.domain([d3.min(data, function(d) { return d.start; }),d3.max(data, function(d) { return d.end; })]);
y.domain([0,d3.max(data, function(d) { return d.duration; })]);
r.domain(d3.extent(data, function(d) { return d.batDeath; }));
color.domain(d3.extent(data, function(d) { return d.batDeath; }));
var war = svg.selectAll(".war")
.data(data)
.enter().append("g")
.attr("class","war");
war.append("path")
.attr("class","curves")
.attr("d", diag)
.attr("fill","none")
.attr("stroke-width",1)
.attr("stroke",function(d) { return color(d.batDeath); });
war.append("circle")
.attr("class","circle")
.attr("r", function(d) { return r(d.batDeath); })
.attr("cx",function(d) { return x(d.end)})
.attr("cy",function(d) { return y(d.duration)})
.attr("fill",function(d) { return color(d.batDeath)})
.attr("stroke","white")
.attr("stroke-width",1.5);
svg.append("g")
.attr("class", "y axis")
.attr("transform", "translate(" + width + ",0)")
.call(yAxis)
.append("text")
.attr("x", 0)
.attr("y", 10)
.attr("transform", "rotate(-90)")
.style("text-anchor", "end")
.style("font-weight","bold")
.text("Duration (years)");
svg.append("g")
.attr("class", "x axis")
.attr("transform", "translate(0," + height + ")")
.call(xAxis);
});
</script>
name,start,end,batDeath
Franco-Spanish War,04-07-1823,11-13-1823,1000
First Russo-Turkish,4-26-1828,9-14-1829,130000
Mexican-American,4-25-1846,9-14-1847,19283
Austro-Sardinian,3-29-1848,8-9-1848,7527
First Schleswig-Holstein,4-10-1848,8-26-1848,6000
Roman Republic,4-30-1849,7-2-1849,2600
La Plata,7-19-1851,2-3-1852,1300
Crimean,10-23-1853,3-1-1856,264200
Anglo-Persian,10-25-1856,4-5-1857,2000
Italian Unification,4-29-1859,7-12-1859,22500
First Spanish-Moroccan,10-22-1859,3-25-1860,10000
Italian-Roman,9-11-1860,9-29-1860,1000
Neapolitan,10-15-1860,2-13-1861,1000
Franco-Mexican,4-16-1862,2-5-1867,20000
Ecuadorian-Colombian,11-22-1863,12-6-1863,1000
Second Schleswig-Holstein,2-1-1864,4-25-1864,4481
Lopez,3-5-1865,3-1-1870,310000
Naval War,9-25-1865,5-9-1866,1000
Seven Weeks,6-20-1866,7-26-1866,44100
Franco-Prussian,7-19-1870,11-25-1870,204313
First Central American,3-27-1876,4-25-1876,4000
Second Russo-Turkish,4-24-1877,1-31-1878,285000
War of the Pacific,2-14-1879,12-11-1883,13868
Conquest of Egypt,7-11-1882,9-15-1882,10079
Sino-French,6-15-1884,6-9-1885,12100
Second Central American,3-28-1885,4-15-1885,1000
First Sino-Japanese,7-25-1894,3-30-1895,15000
Greco-Turkish,2-15-1897,5-19-1897,2000
Spanish-American,4-22-1898,8-12-1898,3685
Boxer Rebellion,6-17-1900,8-14-1900,3003
Sino-Russian,7-17-1900,10-10-1900,4000
Russo-Japanese,2-8-1904,9-15-1905,151831
Third Central American,5-27-1906,7-20-1906,1000
Fourth Central American,2-19-1907,4-23-1907,1000
Second Spanish-Moroccan,7-7-1909,3-23-1910,10000
Italian-Turkish,9-29-1911,10-18-1912,20000
First Balkan,10-17-1912,4-19-1913,82000
Second Balkan,7-15-1913,7-30-1913,60500
World War I,7-29-1914,11-11-1918,8578031
Estonian Liberation,11-22-1918,1-3-1920,11750
Latvian Liberation,12-7-1918,4-15-1919,13246
Russo-Polish,2-14-1919,10-18-1920,100000
Hungarian Adversaries,4-16-1919,8-4-1919,11000
Second Greco-Turkish,5-5-1919,10-11-1922,50000
Franco-Turkish,11-1-1919,10-20-1921,40000
Lithuanian-Polish,7-15-1920,12-1-1920,1000
Manchurian,8-17-1929,12-3-1929,3200
Second Sino-Japanese,12-19-1931,5-22-1933,60000
Chaco,6-15-1932,6-12-1935,92661
Saudi-Yemeni,3-20-1934,5-13-1934,2100
Conquest of Ethiopia,10-3-1935,5-9-1936,20000
Third Sino-Japanese,7-7-1937,12-6-1941,1000000
Changkufeng,7-29-1938,8-11-1938,1726
Nomonhan,5-11-1939,9-16-1939,28000
World War II,6-27-1941,1-20-1945,16634907
Russo-Finnish,11-30-1939,3-12-1940,151798
Franco-Thai,12-1-1940,1-28-1941,1400
First Kashmir,10-26-1947,1-1-1949,3500
Arab-Israeli,5-15-1948,7-18-1948,8000
Korean,10-27-1950,7-27-1953,910084
Off-shore Islands,9-3-1954,4-23-1955,2370
Sinai War,10-31-1956,11-6-1956,3221
Soviet Invasion of Hungary,11-4-1956,11-14-1956,2426
IfniWar,2-10-1958,4-10-1958,1122
Taiwan Straits,8-23-1958,11-23-1958,1800
Assam,10-20-1962,11-22-1962,1853
"Vietnam War, Phase 2",2-7-1965,1-27-1973,1021442
Second Kashmir,8-5-1965,9-23-1965,7061
Six Day War,6-5-1967,6-10-1967,19600
"Second Laotian, Phase 2",1-13-1968,4-17-1973,13866
War of Attrition,3-6-1969,8-7-1970,5368
Football War,7-14-1969,7-18-1969,1900
Communist Coalition,3-23-1970,7-2-1971,6525
Bangladesh,12-3-1971,12-17-1971,11223
Yom Kippur War,10-6-1973,10-24-1973,14439
Turco-Cypriot,7-20-1974,7-29-1974,1500
War over Angola,10-23-1975,2-12-1976,2700
"Second Ogaden War, Phase 2",7-23-1977,3-9-1978,10500
Vietnamese-Cambodian,9-24-1977,1-8-1979,8000
Ugandian-Tanzanian,10-28-1978,4-11-1979,3000
Sino-Vietnamese Punitive,2-17-1979,3-16-1979,21000
Iran-Iraq,9-22-1980,8-20-1988,1250000
Falkland Islands,3-25-1982,6-15-1982,1001
War over Lebanon,4-21-1982,9-15-1982,1655
War over the Aouzou Strip,11-15-1986,9-11-1987,8000
Sino-Vietnamese Border War,1-5-1987,2-6-1987,4000
Gulf War,8-2-1990,4-11-1991,41466
Bosnian Independence,4-7-1992,5-13-1992,5240
Azeri-Armenian,2-6-1993,5-12-1994,14000
Cenepa Valley,1-9-1995,2-27-1995,1500
Badme Border,5-6-1998,12-12-2000,120000
War for Kosovo,3-24-1999,6-10-1999,5002
Kargil War,5-8-1999,7-17-1999,1172
Invasion of Afghanistan,11-15-2001,12-22-2001,4002
Invasion of Iraq,3-19-2003,5-2-2003,7173