Skip to content

Instantly share code, notes, and snippets.

@naxxateux
Last active January 4, 2016 08:09
Show Gist options
  • Save naxxateux/8593873 to your computer and use it in GitHub Desktop.
Save naxxateux/8593873 to your computer and use it in GitHub Desktop.
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0
0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0
0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0
0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0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 0 0 0
0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0
0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0
company productType numberOfInvestors color
myWishBoard.com Wish List 1 #ffffff
paybygroup.com ПЛАТЕЖИ И ПЕРЕВОДЫ 1 #ffffff
Payleven MPOS-ЭКВАЙРИНГ 1 #ffffff
Realcrowd.com КРАУДИНВЕСТИНГ 1 #ffffff
Rocketbank БАНКИ «MOBILE FIRST» 1 #ffffff
SaveUp E-COMMERCE 1 #ffffff
Simple PFP 1 #ffffff
Simplee.com ПЛАТЕЖИ И ПЕРЕВОДЫ 1 #ffffff
Suprmasv - 1 #ffffff
TapCanvas.com СЕРВИСЫ ДЛЯ МАЛОГО И СРЕДНЕГО БИЗНЕСА 1 #ffffff
Trov - 1 #ffffff
Ubank БАНКИ «MOBILE FIRST» 1 #ffffff
Vend E-COMMERCE 1 #ffffff
WalletKit.com E-COMMERCE 1 #ffffff
Waveapps.com СЕРВИСЫ ДЛЯ МАЛОГО И СРЕДНЕГО БИЗНЕСА 1 #ffffff
WeFunder.com КРАУДФАНДИНГ 1 #ffffff
learnvest.com PFP 2 #ffffff
ondeckcapital.com P2P-КРЕДИТОВАНИЕ 2 #ffffff
Remitly E-COMMERCE 2 #ffffff
Shopify E-COMMERCE 2 #ffffff
SumUp MPOS-ЭКВАЙРИНГ 2 #ffffff
Transferwise ПЛАТЕЖИ И ПЕРЕВОДЫ 2 #ffffff
BillFloat.com ПЛАТЕЖИ И ПЕРЕВОДЫ 3 #ffffff
iZettle MPOS-ЭКВАЙРИНГ 2 #ffffff
mFoundry.com ПЛАТЕЖИ И ПЕРЕВОДЫ 3 #ffffff
ZenPayroll СЕРВИСЫ ДЛЯ МАЛОГО И СРЕДНЕГО БИЗНЕСА 3 #ffffff
LendingClub P2P-КРЕДИТОВАНИЕ 4 #ffffff
WePay E-COMMERCE 4 #ffffff
Clinkle ПЛАТЕЖИ И ПЕРЕВОДЫ 5 #ffffff
CoinBase.com BITCOIN 5 #ffffff
FundersClub КРАУДИНВЕСТИНГ 7 #ffffff
LendUp P2P-КРЕДИТОВАНИЕ 7 #ffffff
Upstart КРАУДФАНДИНГ 6 #ffffff
Creditkarma.com МИКРО-КРЕДИТОВАНИЕ ОНЛАЙН 5 #ffffff
AngelList КРАУДИНВЕСТИНГ 4 #ffffff
fundingcircle.com P2P-КРЕДИТОВАНИЕ 4 #ffffff
gocardless.com ПЛАТЕЖИ И ПЕРЕВОДЫ 4 #ffffff
PayNearMe ПЛАТЕЖИ И ПЕРЕВОДЫ 3 #ffffff
Prosper P2P-КРЕДИТОВАНИЕ 3 #ffffff
Stripe E-COMMERCE 3 #ffffff
avantcredit.com P2P-КРЕДИТОВАНИЕ 2 #ffffff
Belly E-COMMERCE 2 #ffffff
CircleUp КРАУДИНВЕСТИНГ 2 #ffffff
Dwolla ПЛАТЕЖИ И ПЕРЕВОДЫ 2 #ffffff
Erply E-COMMERCE 2 #ffffff
Gyft.com ШОППИНГ И ЛОЯЛЬНОСТЬ 2 #ffffff
Kabbage МИКРО-КРЕДИТОВАНИЕ ОНЛАЙН 2 #ffffff
Azimo - 1 #ffffff
Bigcommerce.com E-COMMERCE 1 #ffffff
bill.com ПЛАТЕЖИ И ПЕРЕВОДЫ 1 #ffffff
BitPay BITCOIN 1 #ffffff
Fidor Russia БАНКИ «MOBILE FIRST» 1 #ffffff
Flint ПЛАТЕЖИ И ПЕРЕВОДЫ 1 #ffffff
Index.com E-COMMERCE 1 #ffffff
KashFlow СЕРВИСЫ ДЛЯ МАЛОГО И СРЕДНЕГО БИЗНЕСА 1 #ffffff
Kreditech СЕРВИСЫ ДЛЯ МАЛОГО И СРЕДНЕГО БИЗНЕСА 1 #ffffff
lendkey.com P2P-КРЕДИТОВАНИЕ 1 #ffffff
Level PFM 1 #ffffff
LifePAD T-FINANCE 1 #ffffff
Mambu.com МИКРО-КРЕДИТОВАНИЕ ОНЛАЙН 1 #ffffff
MotifInvesting.com СОЦИАЛЬНЫЕ СЕТИ ТРЕЙДЕРОВ 1 #ffffff
Moven PFP 1 #ffffff
<!DOCTYPE html>
<meta charset="utf-8">
<html>
<head>
<script src="http://d3js.org/d3.v3.min.js"></script>
<title>Investments</title>
</head>
<body>
<div id="chart" align="center"></div>
<script>
var margin = {
top: 50,
right: 20,
bottom: 50,
left: 20
},
width = 1500 - margin.right - margin.left,
height = width * 1.4 - margin.bottom - margin.top;
var companiesData,
investorsData,
companiesInvestorsMatrix,
nOfCompanies,
nOfInvestors;
var companyRectWidth = 120,
companyRectWidthMultiplier = 30,
companyRectHeight = 20,
companyRectRx = 10,
companyRectRy = 10;
var investorsCirclesPadding = {
right: 200,
left: 200
},
investorsCirclesSquareMultiplier = 300,
investorsTextPadding = 40;
d3.csv("companies.csv", function(error, data) {
if (error) {
console.log(error);
} else {
companiesData = data;
d3.csv("investors.csv", function(error, data) {
if (error) {
console.log(error);
} else {
investorsData = data;
d3.text("companies-investors.csv", function(error, data) {
if (error) {
console.log(error);
} else {
companiesInvestorsMatrix = d3.csv.parseRows(data).map(function(row) {
return row.map(function(value) {
return +value;
});
});
var svg = d3.select("#chart").append("svg")
.attr("width", width + margin.left + margin.right)
.attr("height", height + margin.top + margin.bottom)
.style("border", "1px solid black")
.append("g")
.attr("transform", "translate(" + margin.left + "," + margin.top + ")");
nOfCompanies = companiesData.length;
nOfInvestors = investorsData.length;
var companiesYScale = d3.scale.linear()
.domain([0, nOfCompanies - 1])
.range([0, height]);
var investorsYScaleRight = d3.scale.linear()
.domain([0, 17])
.range([0, height]);
var investorsYScaleLeft = d3.scale.linear()
.domain([0, 17])
.range([0, height]);
// Connections
for (i = 0; i < nOfCompanies; i++) {
for (j = 0; j < nOfInvestors; j++) {
if (companiesInvestorsMatrix[i][j] === 1) {
var x1 = (j < nOfInvestors / 2 ? (width / 2 + companyRectWidth / 2 + companiesData[i].numberOfInvestors * companyRectWidthMultiplier / 2) : (width / 2 - companyRectWidth / 2 - companiesData[i].numberOfInvestors * companyRectWidthMultiplier / 2)),
y1 = companiesYScale(i),
x4 = (j < nOfInvestors / 2 ? (width - investorsCirclesPadding.right) : investorsCirclesPadding.left),
y4 = (j < nOfInvestors / 2 ? investorsYScaleRight(j) : investorsYScaleLeft(j - nOfInvestors / 2)),
x2 = (j < nOfInvestors / 2 ? (x1 + (x4 - x1) / 2) : (x1 - (x1 - x4) / 2)),
y2 = y1,
x3 = x2,
y3 = y4;
svg.append("path")
.attr("d", function() {
//return "M " + x1 + "," + y1 + " C " + x2 + "," + y2 + " " + x3 + "," + y3 + " " + x4 + "," + y4;
return "M " + x1 + "," + y1 + " L " + " " + x4 + "," + y4;
})
.attr("fill", "none")
.attr("stroke", function() {
if (investorsData[j].color === "#ffffff") {
return "black";
} else {
return (investorsData[j].color);
}
})
.attr("stroke-width", function() {
if (investorsData[j].color === "#ffffff") {
return 0.2;
} else {
return 1;
}
});
}
}
}
// Companies
var companies = svg.append("g")
.selectAll("g")
.data(companiesData)
.enter()
.append("g")
.attr("transform", function(d, i) {
return ("translate(" + width / 2 + "," + companiesYScale(i) + ")");
});
companies.append("rect")
.attr("x", function(d) {
return (-companyRectWidth / 2 - d.numberOfInvestors * companyRectWidthMultiplier / 2);
})
.attr("y", -companyRectHeight / 2)
.attr("rx", companyRectRx)
.attr("ry", companyRectRy)
.attr("width", function(d) {
return (companyRectWidth + d.numberOfInvestors * companyRectWidthMultiplier);
})
.attr("height", companyRectHeight)
.attr("fill", function(d) {
return d.color;
})
.attr("stroke", "black")
.attr("stroke-width", 0.2);
companies.append("text")
.attr("font-family", "Arial")
.attr("font-size", "10px")
.attr("dominant-baseline", "middle")
.attr("text-anchor", "middle")
.attr("fill", "black")
.text(function(d) {
return d.company;
})
// Investors
var investors = svg.append("g")
.selectAll("g")
.data(investorsData)
.enter()
.append("g")
.attr("transform", function(d, i) {
if (i < nOfInvestors / 2) {
return ("translate(" + (width - investorsCirclesPadding.right) + "," + investorsYScaleRight(i) + ")");
} else {
return ("translate(" + investorsCirclesPadding.left + "," + investorsYScaleLeft(i - nOfInvestors / 2) + ")");
}
});
investors.append("circle")
.attr("r", function(d) {
return (Math.sqrt(d.numberOfInvestments * investorsCirclesSquareMultiplier / Math.PI));
})
.attr("fill", function(d) {
return d.color;
})
.attr("stroke", "black")
.attr("stroke-width", 0.2);
investors.append("text")
.attr("x", function(d, i) {
if (i < nOfInvestors / 2) {
return investorsTextPadding;
} else {
return -investorsTextPadding;
}
})
.attr("font-family", "Arial")
.attr("font-size", "10px")
.attr("dominant-baseline", "middle")
.attr("text-anchor", function(d, i) {
if (i < nOfInvestors / 2) {
return "start";
} else {
return "end";
}
})
.attr("fill", "black")
.text(function(d) {
return d.investor;
});
}
});
}
});
}
});
</script>
</body>
</html>
investor numberOfInvestments color
BBVA Ventures 1 #ffffff
Runa Capital 2 #ffffff
New Enterprise Associates 3 #ffffff
Point Nine Capital 3 #ffffff
Ribbit Capital 3 #ffffff
August Capital 4 #024A01
500 Startups 5 #3D3C3E
Andreessen Horowitz 6 #E96E71
Y Combinator 9 #161443
Google Ventures 7 #2136D7
Accel Partners 5 #282828
Kleiner Perkins Caufield & Byers 5 #BF5E3B
Draper Fisher Jurvetson (DFJ) 4 #22BDAF
Start Fund 3 #ffffff
The Social+Capital Partnership 3 #ffffff
Thomvest Ventures 3 #ffffff
True Ventures 3 #ffffff
Founder's Coop 1 #ffffff
Intuit 2 #ffffff
General Catalyst Partners 3 #ffffff
Ignition Partners 3 #ffffff
Intel Capital 3 #ffffff
Khosla Ventures 4 #48352F
QED Investors 5 #024A01
Union Square Ventures 5 #3D3C3E
SV Angel 8 #E96E71
Index Ventures 5 #161443
Лайф.Среда 5 #2136D7
First Round Capital 4 #282828
American Express 3 #ffffff
Anthemis 3 #ffffff
Felicis Ventures 3 #ffffff
Founders Fund 3 #ffffff
PayPal 2 #ffffff
FirstMark Capital 1 #ffffff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment