-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstartup-financing.html
1047 lines (929 loc) · 35.8 KB
/
startup-financing.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE HTML>
<html>
<head>
<title>How Startup Financing Works</title>
<meta charset="utf-8">
<script src="http://d3js.org/d3.v3.min.js"></script>
<style>
body {
width: 700px;
margin: 2em;
font-size: 150%;
color: #020304;
}
.left {
width: 700px;
}
h1 {
color: #541714;
text-align: center;
margin-bottom: 0px;
}
h1 .title {
font-size: 200%;
color: #cc9e61;
font-weight: 900;
}
h2 {
font-size: 200%;
color: #541714;
text-align: center;
font-variant: small-caps;
border-bottom: thin gray dashed;
border-top: thin gray dashed;
}
p:not(:first-of-type), div.p {
text-indent: 1em;
}
p:first-of-type:first-letter {
float:left;
color: #541714;
font-size: 3em;
line-height: 60px;
}
div.p {
margin: 24px 0px;
}
strong {
color: #cc9e61;
}
.controls {
text-align: center;
}
.valuecontrolvertical {
width: 280px;
}
.valuecontrol {
text-align: center;
text-indent: 0px;
display: inline-block;
border-radius: 6px;
background-color: #938172;
color: #020304;
margin: 1px;
vertical-align: middle;
}
.valuecontrol:hover {
opacity: 0.9;
}
.valuecontrol .title {
padding: 0.5em 0.5em 0 0.5em;
font-weight: bold;
}
.valuecontrol .inlinetitle {
display: inline-block;
}
.valuecontrol .inlinetitle:first-child {
padding: 0.5em 0em 0.25em 0.5em;
}
.valuecontrol .inlinetitle:last-child {
padding: 0.5em 0.5em 0.25em 0em;
}
.valuecontrol .value {
padding: 0em 0.5em 0.25em 0.5em;
}
.valuecontrol input {
vertical-align: middle;
}
.valuecontrol .control {
margin: 0px;
padding: 0px;
}
.valuecontrol .control input {
margin: 0px;
padding: 0px;
}
.and {
font-weight: bold;
margin: 0.5em;
color: #cc9e61;
}
.chart {
text-align: center;
}
path { stroke: #fff; }
path:hover { opacity:0.9; }
rect:hover { fill:blue; }
.axis { font: 10px sans-serif; }
.legend tr{ border-bottom:1px solid grey; }
.legend tr:first-child{ border-top:1px solid grey; }
.axis path,
.axis line {
fill: none;
stroke: #000;
shape-rendering: crispEdges;
}
.x.axis path { display: none; }
.legend{
margin-bottom:76px;
display:inline-block;
border-collapse: collapse;
border-spacing: 0px;
}
.legend td{
padding:4px 5px;
vertical-align:bottom;
}
.legendFreq, .legendPerc{
align:right;
width:50px;
}
.byline {
text-align: right;
font-style: italic;
font-size: smaller;
}
.byline a {
text-decoration: none;
color: #cc9e61;
margin-left: 4px;
font-style: normal;
}
.gravatar {
vertical-align: middle;
}
.areaText {
color: white;
text-size: smaller;
}
.startupspotlogo {
vertical-align: middle;
}
.sponsors {
margin-top: 20px;
border-top: thin dashed gray;
border-bottom: thin dashed gray;
font-size: smaller;
text-align: center;
}
.license {
font-size: smaller;
padding: 2px 6px;
text-align: center;
}
.license img {
float: left;
margin-bottom: 450px;
}
.convertible {
display: inline-block;
width: 45%;
vertical-align: top;
margin-left: 2%;
margin-right: 2%;
opacity: 0.4;
}
.participating {
display: inline-block;
width: 45%;
vertical-align: top;
padding-left: 2%;
margin-right: 2%;
opacity: 0.4;
border-left: thin gray solid;
}
.active {
opacity: 1.0;
}
.bottom {
width: 700px;
height: 400px;
position: fixed;
bottom: 0;
left: 2em;
background-color: white;
border: thin gray solid;
opacity: 1;
z-index: 100;
}
.right {
width: 500px;
height: 400px;
position: fixed;
top: 20px;
left: 800px;
}
#exitpercent {
text-align: right;
}
</style>
</head>
<body>
<div class="left">
<h1>How <span class="title">Startup Financing</span> Works</h1>
<div class="byline">
by <img class="gravatar" src="https://secure.gravatar.com/avatar/b29a6f56dcf2607af909970c17fee58e?d=mm&s=40" style="width: 40px; height: 40px;"><a href="http://www.myshoggoth.com/">Andrew Boardman</a>
</div>
<h2>Valuation</h2>
<p>There are two basic levers to determine ownership after the investment.</p>
<div class="controls">
<div class="valuecontrol valuecontrolvertical">
<div class="title">
Pre-Money Valuation
</div>
<div class="control">
<input type="range" name="points" min="0" max="20000000" step="100000" value="0" id="slider-premoney" style="width: 100%;">
</div>
<div class="value" id="premoney"></div>
</div>
<span class="and">and</span>
<div class="valuecontrol valuecontrolvertical">
<div class="title">
Investment Size
</div>
<div class="control">
<input type="range" name="points" min="0" max="20000000" step="100000" value="0" id="slider-investment" style="width: 100%;">
</div>
<div class="value" id="investment"></div>
</div>
</div>
<div id="premoney-chart" class="chart"></div>
<h2>Stock Option Pool</h2>
<div class="p">Stock options are created from the
<div class="valuecontrol valuecontrolvertical">
<div class="title">
Option Pool
</div>
<div class="control">
<input type="range" name="points" min="0" max="100" step="1" value="0" id="slider-optionpool" style="width: 100%;">
</div>
<div class="value" id="optionpool"></div>
</div>, shares set aside by the company to attract and retain key employees. It can be created from either the <div class="valuecontrol"><div class="inlinetitle">Pre-Money</div><input type="range" name="points" min="0" max="1" step="1" value="0" id="slider-optionpoolorigin" style="width: 60px;"><div class="inlinetitle">Post-Money</div></div> side of the <strong>Financing Round</strong>.</div>
<div id="optionpool-chart" class="chart"></div>
<h2>Convertible Debt</h2>
<div class="p"><strong>Convertible Debt</strong> is a popular way to do early financing. It allows the company to raise money while deferring the <strong>Valuation</strong> of the company until the next <strong>Financing Round</strong>.</div>
<div class="p">To reward the <strong>Angel Investors</strong> for risking their money early at an unknown <strong>Valuation</strong>, they normally ask for a
<div class="valuecontrol valuecontrolvertical">
<div class="title">Discount</div>
<div class="control">
<input type="range" name="points" min="0" max="50" step="1" value="0" id="slider-debtdiscount" style="width: 100%;">
</div>
<div class="value" id="debtdiscount"></div>
</div>
to the next round's <strong>Share Price</strong>, and/or a <strong>Pre-Money</strong>
<div class="valuecontrol valuecontrolvertical">
<div class="title">Valuation Cap</div>
<div class="control">
<input type="range" name="points" min="0" max="20000000" step="100000" value="0" id="slider-debtcap" style="width: 100%;">
</div>
<div class="value" id="debtcap"></div>
</div>. The
<div class="valuecontrol valuecontrolvertical">
<div class="title">Convertible Debt</div>
<div class="control">
<input type="range" name="points" min="0" max="10000000" step="100000" value="0" id="slider-debt" style="width: 100%;">
</div>
<div class="value" id="debt"></div>
</div>
converts into the same type of stock as the next round of financing, with the same terms.
</div>
<div id="debt-chart" class="chart"></div>
<h2>Exit Terms</h2>
<div class="p">
The
<div class="valuecontrol valuecontrolvertical">
<div class="title">Liquidation Preference</div>
<div class="control">
<input type="range" name="points" min="0" max="10" step="0.5" value="0" id="slider-liqpref" style="width: 100%;">
</div>
<div class="value" id="liqpref"></div>
</div> determines how much of the investment is returned to the investor before others receive any money, based on the round's <strong>Stock Type</strong>:</div>
<div class="controls"><div class="valuecontrol"><div class="inlinetitle">Convertible Preferred</div><input type="range" name="points" min="0" max="1" step="1" value="0" id="slider-convpart" style="width: 60px;"><div class="inlinetitle">Participating Preferred</div></div>
</div>
<div class="convertible">
<p>The shares are either converted into <strong>Common</strong>, or the investors take the amount they invested times the <strong>Liquidation Preference</strong>, whichever returns more money.</p>
</div>
<div class="participating">
<p>The shares are converted into <strong>Common</strong>, as well as the investors take the amount they invested times the <strong>Liquidation Preference</strong>.</p>
<div class="p">This is known as a <strong>Double Dip</strong>, and the effects are pronounced at lower exits. To reduce that impact, a
<div class="valuecontrol valuecontrolvertical">
<div class="title">Liquidation Cap</div>
<div class="control">
<input type="range" name="points" min="0" max="20" step="1" value="0" id="slider-liqcap" style="width: 100%;">
</div>
<div class="value" id="liqcap"></div>
</div>
can be applied, which removes the <strong>Liquidation Preference</strong> once that investor's returns reach the cap.
</div>
</div>
<div id="exitpercent" class="inlinechart">
<select id="exitpercentdisplay">
<option value="inline">Default</option>
<option value="bottom">Always show - bottom</option>
<option value="right">Always show - right</option>
</select>
<div id="liqpref-chart" class="chart"></div>
</div>
<div class="sponsors">Generously sponsored by <a href="http://www.causationlabs.com/">Causation Labs LLC</a> and <a href="https://www.startupspot.com/" title="Educating & Empowering Entrepreneurs"><img class="startupspotlogo" src="http://www.startupspot.com/wp-content/uploads/2012/07/sxs-sm.png" alt="StartupSpot"></a>.</div>
<div class="license"><a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-sa/4.0/88x31.png" /></a> This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike 4.0 International License</a>.</div>
</div>
<script>
var data = [
{
"name": "Founding",
"stockType": "Restricted",
"date": "01/01/2015",
"preMoneyValuation": "0.0",
"optionPoolPercent": "0.0",
"optionPoolPreMoney": 't',
"dividendCompounding": 't',
"liquidationPref": "0.0",
"liquidationCap": "0.0",
"investments": [
{
"name": "Founders",
"shares": "3000000"
}
]
},
{
"name": "Seed",
"stockType": "Convertible Debt",
"date": "01/01/2015",
"preMoneyValuation": "0.0",
"optionPoolPercent": "0.0",
"optionPoolPreMoney": 't',
"dividendCompounding": 't',
"liquidationPref": "0.0",
"liquidationCap": "0.0",
"investments": [
{
"name": "Angels",
"amount": "500000",
"term": "18",
"discount": "0.2",
"cap": "5000000"
}
]
},
{
"name": "Series A",
"stockType": "Convertible Preferred",
"date": "02/01/2015",
"preMoneyValuation": "3000000",
"optionPoolPercent": "0.1",
"optionPoolPreMoney": 't',
"dividendCompounding": 't',
"liquidationPref": "2.0",
"liquidationCap": "0.0",
"investments": [
{
"name": "VCs",
"amount": "2000000"
}
]
}
];
function updatePreMoney() {
d3.select("#slider-premoney").property("value", data[2].preMoneyValuation);
d3.select("#premoney").text( "$" + d3.format(",")(data[2].preMoneyValuation) );
}
function updateInvestment() {
d3.select("#slider-investment").property("value", data[2].investments[0].amount);
d3.select("#investment").text( "$" + d3.format(",")(data[2].investments[0].amount) );
}
function updateOptionPool() {
d3.select("#slider-optionpool").property("value", data[2].optionPoolPercent * 100);
d3.select("#optionpool").text(d3.format("%")(data[2].optionPoolPercent) );
}
function updateOptionPoolOrigin() {
d3.select("#slider-optionpoolorigin").property("value", data[2].optionPoolPreMoney == 't' ? 0 : 1);
}
function updateDebt() {
d3.select("#slider-debt").property("value", data[1].investments[0].amount);
d3.select("#debt").text( "$" + d3.format(",")(data[1].investments[0].amount) );
}
function updateDebtDiscount() {
d3.select("#slider-debtdiscount").property("value", data[1].investments[0].discount * 100);
d3.select("#debtdiscount").text(d3.format("%")(data[1].investments[0].discount) );
}
function updateDebtCap() {
d3.select("#slider-debtcap").property("value", data[1].investments[0].cap);
d3.select("#debtcap").text("$" + d3.format(",")(data[1].investments[0].cap) );
}
function updateLiqPref() {
d3.select("#slider-liqpref").property("value", data[2].liquidationPref);
d3.select("#liqpref").text(data[2].liquidationPref + "x");
}
function updateLiqCap() {
d3.select("#slider-liqcap").property("value", data[2].liquidationCap);
d3.select("#liqcap").text(data[2].liquidationCap + "x");
}
function updateConvPart() {
d3.select("#slider-convpart").property("value", data[2].stockType == "Convertible Preferred" ? 0 : 1);
d3.select(".convertible").attr("class", data[2].stockType == "Convertible Preferred"? "active convertible" : "convertible");
d3.select(".participating").attr("class", data[2].stockType == "Convertible Preferred" ? "participating" : "active participating");
}
function segColor(c) {
switch (c.name.toLowerCase()) {
case "founders":
color = "#541714";
break;
case "vcs":
color = "#938172";
break;
case "option pool":
color = "#cc9e61";
break;
case "angels":
color = "#626266";
break;
}
return color;
}
function postmoney(round) {
return parseFloat(round.preMoneyValuation) + parseFloat(round.investments[0].amount);
}
function percentOwnershipPreMoney(c) {
percentOwnershipSeriesA = parseFloat(data[2].investments[0].amount) / postmoney(data[2])
if (c.name == "Series A") {
return percentOwnershipSeriesA;
} else {
return (1.0 - percentOwnershipSeriesA);
}
}
function percentOwnershipOptionPool(c) {
base = percentOwnershipPreMoney(c);
optionPool = parseFloat(data[2].optionPoolPercent);
if (data[2].optionPoolPreMoney == 't' && c.name == "Founding") {
return Math.max(base - optionPool, 0.0);
}
if (data[2].optionPoolPreMoney == 'f') {
return Math.max(base - (optionPool / 2.0), 0.0);
}
return base;
}
function percentOwnershipDebt(c) {
if (data[1].investments[0].cap > 0)
{
effectivePreMoney = Math.min(parseFloat(data[2].preMoneyValuation), parseFloat(data[1].investments[0].cap));
} else {
effectivePreMoney = data[2].preMoneyValuation;
}
effectiveDebtAmount = parseFloat(data[1].investments[0].amount) / (1.0 - parseFloat(data[1].investments[0].discount));
effectiveDebtAmount = (parseFloat(data[2].preMoneyValuation) / effectivePreMoney) * effectiveDebtAmount;
totalShares = parseInt(data[0].investments[0].shares);
postMoney = effectiveDebtAmount + parseFloat(data[2].investments[0].amount) + parseFloat(data[2].preMoneyValuation);
optionPool = parseFloat(data[2].optionPoolPercent);
if (data[2].optionPoolPreMoney == 't') {
totalInvestorsChunk = (effectiveDebtAmount + parseFloat(data[2].investments[0].amount)) / postMoney;
investorPercent = Math.min(parseFloat(data[2].investments[0].amount) / postMoney, 1.0 - optionPool);
debtPercent = Math.min(effectiveDebtAmount / postMoney, 1.0 - optionPool);
founderPercent = Math.max(1.0 - (totalInvestorsChunk + optionPool), 0);
} else {
totalPreShares = totalShares;
effectivePps = parseFloat(data[2].preMoneyValuation) / totalPreShares;
debtShares = effectiveDebtAmount / effectivePps;
investorShares = parseFloat(data[2].investments[0].amount) / effectivePps;
totalPostShares = (totalShares + investorShares + debtShares) / (1.0 - optionPool);
founderPercent = Math.min(totalShares / totalPostShares, 1.0 - optionPool);
debtPercent = Math.min(debtShares / totalPostShares, 1.0 - optionPool);
investorPercent = Math.min(investorShares / totalPostShares, 1.0 - optionPool);
}
switch (c.name) {
case 'Founding':
return founderPercent;
case 'Seed':
return debtPercent;
case 'Series A':
return investorPercent;
}
}
function calcPreMoneyOwnerships(data) {
return [
{
"name": data[0].investments[0].name,
"percent": percentOwnershipPreMoney(data[0])
},
{
"name": data[2].investments[0].name,
"percent": percentOwnershipPreMoney(data[2])
}
];
}
function calcOptionPoolOwnerships(data) {
return [
{
"name": data[0].investments[0].name,
"percent": percentOwnershipOptionPool(data[0])
},
{
"name": data[2].investments[0].name,
"percent": percentOwnershipOptionPool(data[2])
},
{
"name": "Option Pool",
"percent": data[2].optionPoolPercent
}
];
}
function calcDebtOwnerships(data) {
return [
{
"name": data[0].investments[0].name,
"percent": percentOwnershipDebt(data[0])
},
{
"name": data[2].investments[0].name,
"percent": percentOwnershipDebt(data[2])
},
{
"name": "Option Pool",
"percent": data[2].optionPoolPercent
},
{
"name": data[1].investments[0].name,
"percent": percentOwnershipDebt(data[1])
}
];
}
function createPieChart(id, fData){
// function to handle pieChart.
function pieChart(pD){
var pC ={}, pieDim ={w:250, h: 250};
pieDim.r = Math.min(pieDim.w, pieDim.h) / 2;
// create svg for pie chart.
var piesvg = d3.select(id).append("svg")
.attr("width", pieDim.w).attr("height", pieDim.h).append("g")
.attr("transform", "translate("+pieDim.w/2+","+pieDim.h/2+")");
// create function to draw the arcs of the pie slices.
var arc = d3.svg.arc().outerRadius(pieDim.r - 10).innerRadius(0);
// create a function to compute the pie slice angles.
var pie = d3.layout.pie().sort(null).value(function(d) { return d.percent; });
// Draw the pie slices.
piesvg.selectAll("path").data(pie(pD)).enter().append("path").attr("d", arc)
.each(function(d) { this._current = d; })
.style("fill", function(d) { return segColor(d.data); });
// create function to update pie-chart. This will be used by histogram.
pC.update = function(nD){
piesvg.selectAll("path").data(pie(nD)).transition().duration(10)
.attrTween("d", arcTween);
}
// Animating the pie-slice requiring a custom function which specifies
// how the intermediate paths should be drawn.
function arcTween(a) {
var i = d3.interpolate(this._current, a);
this._current = i(0);
return function(t) { return arc(i(t)); };
}
return pC;
}
// function to handle legend.
function legend(lD){
var leg = {};
// create table for legend.
var legend = d3.select(id).append("table").attr('class','legend');
// create one row per segment.
var tr = legend.append("tbody").selectAll("tr").data(lD).enter().append("tr");
// create the first column for each segment.
tr.append("td").append("svg").attr("width", '16').attr("height", '16').append("rect")
.attr("width", '16').attr("height", '16')
.attr("fill",function(d){ return segColor(d); });
// create the second column for each segment.
tr.append("td").text(function(d){ return d.type;});
// create the third column for each segment.
tr.append("td").attr("class",'legendName')
.text(function(d){ return d.name; });
// create the fourth column for each segment.
tr.append("td").attr("class",'legendPerc')
.text(function(d){ return d3.format("%")(d.percent); });
// Utility function to be used to update the legend.
leg.update = function(nD){
// update the data attached to the row elements.
var l = legend.select("tbody").selectAll("tr").data(nD);
// update the frequencies.
l.select(".legendFreq").text(function(d){ return d.name; });
// update the percentage column.
l.select(".legendPerc").text(function(d){ return d3.format("%")(d.percent);});
}
function getLegend(d,aD){ // Utility function to compute percentage.
return d3.format("%")(d.percent/d3.sum(aD.map(function(v){ return d.percent; })));
}
return leg;
}
return [ pieChart(fData), legend(fData) ];
}
function calcLiqPrefOwnerships(data) {
dataFounders = {
"name": data[0].investments[0].name,
"color": segColor(data[0].investments[0]),
"values": []
};
dataAngels = {
"name": data[1].investments[0].name,
"color": segColor(data[1].investments[0]),
"values": []
};
dataOptions = {
"name": "Option Pool",
"color": segColor({ "name": "Option Pool" }),
"values": []
};
dataInvestors = {
"name": data[2].investments[0].name,
"color": segColor(data[2].investments[0]),
"values": []
};
investorAmount = parseFloat(data[2].investments[0].amount);
liqPref = parseFloat(data[2].liquidationPref);
liqPrefCap = parseFloat(data[2].liquidationCap);
liqPrefAmount = investorAmount * liqPref;
liqPrefCapAmount = Math.max(investorAmount * liqPrefCap, liqPrefAmount);
founders = percentOwnershipDebt(data[0]);
angels = percentOwnershipDebt(data[1]);
investors = percentOwnershipDebt(data[2]);
options = parseFloat(data[2].optionPoolPercent);
nonInvestors = angels + options + founders;
convertible = data[2].stockType == "Convertible Preferred";
liqPrefCapMin = (liqPrefCapAmount - liqPrefAmount + (liqPrefAmount * investors)) / investors;
liqPrefCapMax = liqPrefCapAmount / investors;
for (i = 100000; i <= 100000000; i += 100000) {
amount = i;
amountAfterPref = amount;
if (amount <= liqPrefAmount) {
amountInvestors = amount;
amountFounders = 0.0;
amountAngels = 0.0;
amountOptions = 0.0;
} else {
if (!convertible && liqPref > 0 && liqPrefCap > 0 && amount >= liqPrefCapMin && amount <= liqPrefCapMax) {
amountInvestors = liqPrefCapAmount;
amountAfterPref = amount - liqPrefCapAmount;
amountFounders = amountAfterPref * (founders / nonInvestors);
amountAngels = amountAfterPref * (angels / nonInvestors);
amountOptions = amountAfterPref * (options / nonInvestors);
} else if (convertible && amount <= liqPrefAmount / investors) {
amountInvestors = liqPrefAmount;
amountAfterPref = amount - liqPrefAmount;
amountFounders = amountAfterPref * (founders / nonInvestors);
amountAngels = amountAfterPref * (angels / nonInvestors);
amountOptions = amountAfterPref * (options / nonInvestors);
} else {
if ((convertible && (amount * investors) >= liqPrefAmount) || (!convertible && liqPrefCap > 0 && amount > liqPrefCapMax)) {
amountInvestors = amount * investors;
amountAfterPref = amount;
} else {
amountAfterPref = amount - liqPrefAmount;
amountInvestors = amountAfterPref * investors + liqPrefAmount;
}
amountFounders = amountAfterPref * founders;
amountAngels = amountAfterPref * angels;
amountOptions = amountAfterPref * options;
}
}
foundersPercent = amountFounders / amount;
angelsPercent = amountAngels / amount;
investorsPercent = amountInvestors / amount;
optionsPercent = amountOptions / amount;
dataFounders.values.push( { exitAmount: i, y0: 0, y: foundersPercent, amount: amountFounders });
dataAngels.values.push( { exitAmount: i, y0: foundersPercent, y: angelsPercent, amount: amountAngels });
dataOptions.values.push( { exitAmount: i, y0: foundersPercent + angelsPercent, y: optionsPercent, amount: amountOptions});
dataInvestors.values.push( { exitAmount: i, y0: foundersPercent + angelsPercent + optionsPercent, y: investorsPercent, amount: amountInvestors, capamount: liqPrefCapAmount });
}
return [
dataFounders,
dataAngels,
dataOptions,
dataInvestors
];
}
function createAreaChart(id, fData) {
var aC = {};
var margin = { top: 10, right: 40, bottom: 40, left: 60 },
width = 600 - margin.left - margin.right,
height = 400 - margin.top - margin.bottom,
contextHeight = 50;
contextWidth = width * 0.5;
var formatPercent = d3.format("%");
var x = d3.scale.linear()
.domain([100000, 100000000])
.range([0, width]);
var y = d3.scale.linear()
.range([height, 0]);
var xAxis = d3.svg.axis()
.scale(x)
.orient("bottom")
.ticks(5)
.tickFormat(function(d) { return "$" + d3.format(",")(d); });
var yAxis = d3.svg.axis()
.scale(y)
.orient("left")
.tickFormat(formatPercent);
var svg = d3.select(id)
.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 + ")");
svg.append("text")
.attr("x", width / 2)
.attr("y", height + margin.bottom)
.style("text-anchor", "middle")
.text("Exit Amount");
svg.append("text")
.attr("transform", "rotate(-90)")
.attr("y", 0 - margin.left)
.attr("x", 0 - (height / 2))
.attr("dy", "1em")
.style("text-anchor", "middle")
.text("Percent of Exit Proceeds");
var area = d3.svg.area()
.x(function(d) { return x(d.exitAmount); })
.y0(function(d) { return y(d.y0); })
.y1(function(d) { return y(d.y0 + d.y); })
.interpolate("basis");
var exitAmount = svg.selectAll(".exitAmount")
.data(fData)
.enter().append("g")
.attr("class", "exitAmount");
exitAmount.append("path")
.attr("class", "area")
.attr("d", function(d) { return area(d.values); })
.style("fill", function(d) { return d.color; });
exitAmount.append("text")
.attr("transform", function(d) { return "translate(" + x(d.values[d.values.length - 1].exitAmount) + "," + y(d.values[d.values.length - 1].y0 + d.values[d.values.length - 1].y / 2) + ")"; })
.attr("x", "-5em")
.attr("dy", ".35em")
.attr("class", "areaText")
.attr("font-size", "16")
.style("fill", function(d) { return "white"; })
.text(function(d) { return d.name; });
svg.append("g")
.attr("class", "x axis")
.attr("transform", "translate(0," + height + ")")
.call(xAxis);
svg.append("g")
.attr("class", "y axis")
.call(yAxis);
// create function to update pie-chart. This will be used by histogram.
aC.update = function(nD){
svg.selectAll(".area").data(nD)
.attr("d", function(d) { return area(d.values); });
svg.selectAll("text.areaText").data(nD)
.attr("transform", function(d) { return "translate(" + x(d.values[d.values.length - 1].exitAmount) + "," + y(d.values[d.values.length - 1].y0 + d.values[d.values.length - 1].y / 2) + ")"; })
}
return [ aC ];
}
var preMoneyCharts = createPieChart('#premoney-chart', calcPreMoneyOwnerships(data));
var optionPoolCharts = createPieChart('#optionpool-chart', calcOptionPoolOwnerships(data));
var debtCharts = createPieChart('#debt-chart', calcDebtOwnerships(data));
var liqPrefCharts = createAreaChart('#liqpref-chart', calcLiqPrefOwnerships(data));
function updatePreMoneyCharts() {
d = calcPreMoneyOwnerships(data);
for (i = 0; i < preMoneyCharts.length; i++) {
preMoneyCharts[i].update(d);
}
}
function updateOptionPoolCharts(charts) {
d = calcOptionPoolOwnerships(data);
for (i = 0; i < optionPoolCharts.length; i++) {
optionPoolCharts[i].update(d);
}
}
function updateDebtCharts(charts) {
d = calcDebtOwnerships(data);
for (i = 0; i < debtCharts.length; i++) {
debtCharts[i].update(d);
}
}
function updateLiqPrefCharts(charts) {
d = calcLiqPrefOwnerships(data);
for (i = 0; i < liqPrefCharts.length; i++) {
liqPrefCharts[i].update(d);
}
}
updatePreMoney();
updateInvestment();
updateOptionPool();
updateOptionPoolOrigin();
updateDebt();
updateDebtDiscount();
updateDebtCap();
updateLiqPref();
updateLiqCap();
updateConvPart();
function getEvent() {
if (/Trident/.test(navigator.userAgent) ||
/MSIE/.test(navigator.userAgent)) {
return 'change';
}
return "input";
}
function updateOnPreMoneyChange(value) {
data[2].preMoneyValuation = parseInt(value);
updatePreMoney();
updatePreMoneyCharts();
updateOptionPoolCharts();
updateDebtCharts();
updateLiqPrefCharts();
}
d3.select("#slider-premoney")
.on(getEvent(), function() {
updateOnPreMoneyChange(this.value);
});
function updateOnInvestmentChange(value) {
data[2].investments[0].amount = parseInt(value);
updateInvestment();
updatePreMoneyCharts();
updateOptionPoolCharts();
updateDebtCharts();
updateLiqPrefCharts();
}
d3.select("#slider-investment")
.on(getEvent(), function() {
updateOnInvestmentChange(this.value);
});
function updateOnOptionPoolChange(value) {
data[2].optionPoolPercent = parseInt(value) / 100.0;
updateOptionPool();
updateOptionPoolCharts();
updateDebtCharts();
updateLiqPrefCharts();
}
d3.select("#slider-optionpool")
.on(getEvent(), function() {
updateOnOptionPoolChange(this.value);
});
function updateOnOptionPoolOriginChange(value) {
data[2].optionPoolPreMoney = (parseInt(value) == 0 ? 't' : 'f');
updateOptionPoolOrigin();
updateOptionPoolCharts();
updateDebtCharts();
updateLiqPrefCharts();
}
d3.select("#slider-optionpoolorigin")
.on(getEvent(), function() {
updateOnOptionPoolOriginChange(this.value);
});
function updateOnDebtChange(value) {
data[1].investments[0].amount = parseInt(value);
updateDebt();
updateDebtCharts();
updateLiqPrefCharts();
}
d3.select("#slider-debt")
.on(getEvent(), function() {
updateOnDebtChange(this.value);
});
function updateOnDebtDiscountChange(value) {
data[1].investments[0].discount = parseInt(value) / 100.0;
updateDebtDiscount();
updateDebtCharts();
updateLiqPrefCharts();
}
d3.select("#slider-debtdiscount")
.on(getEvent(), function() {
updateOnDebtDiscountChange(this.value);
});
function updateOnDebtCapChange(value) {
data[1].investments[0].cap = parseInt(value);
updateDebtCap();
updateDebtCharts();
updateLiqPrefCharts();
}
d3.select("#slider-debtcap")
.on(getEvent(), function() {
updateOnDebtCapChange(this.value);
});
function updateOnLiqPrefChange(value) {