-
Notifications
You must be signed in to change notification settings - Fork 0
/
sankey-reserves-in.html
66 lines (54 loc) · 2.63 KB
/
sankey-reserves-in.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
<!DOCTYPE html>
<html>
<head>
<title>Sankey</title>
<link rel="stylesheet" type="text/css" href="sankey.css">
<link href='http://fonts.googleapis.com/css?family=Lato:700,400,300' rel='stylesheet' type='text/css'>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.min.js" charset="utf-8"></script>
<script type="text/javascript" src="sankey.js"></script>
</head>
<meta charset="utf-8">
<body>
<p>Financial model: last 12 months</p>
<svg class="sankey">
<defs>
<marker id="arrow" markerWidth="2" markerHeight="2" refX="0.1" refY="1" orient="auto">
<path d="M0,0 L1.5,1 L0,2 Z" style="fill: white;" />
</marker>
</defs>
</svg>
<figcaption><b>1</b> The reserves are equivalent to 3 weeks of covered costs</figcaption>
</body>
<script>
var data = [
{source:"billing", target:"costs", value:170, color:"#8bc34a"},
{source:"billing", target:"profits", value:65, color:"#fb8c00"},
{source:"billing", target:"brut income tax", value:5, color:"#e91e63"},
{source:"costs", target:"salaries", value:100, color:"#8bc34a"},
{source:"costs", target:"expenses", value:70, color:"#ffc107"},
{source:"profits", target:"margin", value:5, color:"#ff9800"},
{source:"profits", target:"income tax", value:5, color:"#ff5722"},
{source:"profits", target:"+18% of reserves¹", value:55, color:"#f44336", reserves: 300},
{source:"salaries", target:"productive salaries", value:70, color:"#8bc34a"},
{source:"salaries", target:"contributions", value:15, color:"#cddc39"},
{source:"salaries", target:"administrative salaries", value:15, color:"#ffeb3b"},
{source:"productive salaries", target:"hours", value:70, color:"#009688", backward:true},
{source:"hours", target:"vacations", value:5, color:"#bdbdbd", backward:true},
{source:"hours", target:"not billable", value:5, color:"#9e9e9e", backward:true},
{source:"hours", target:"not worked", value:10, color:"#616161", backward:true},
{source:"hours", target:"billing", value:50, color:"#009688", fix:240}
];
var sankey,
p = document.querySelector("p"),
figCaption = document.querySelector("figCaption");
window.onload = function() {
sankey = new Sankey(document.querySelector(".sankey"), data);
sankey.size([window.innerWidth - 20, window.innerHeight - p.clientHeight - figCaption.clientHeight - 20]);
sankey.render();
}
window.addEventListener("resize", function (e) {
sankey.size([window.innerWidth - 20, window.innerHeight - p.clientHeight - figCaption.clientHeight - 20]);
sankey.render();
})
</script>
</html>