-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
72 lines (69 loc) · 2.07 KB
/
index.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
<!DOCTYPE html>
<html lang="en">
<head>
<style>
html, body, #container {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
</style>
<meta charset="UTF-8">
<title>{{ title }}</title>
<script src="https://cdn.anychart.com/releases/v8/js/anychart-base.min.js"></script>
<script src="https://cdn.anychart.com/releases/v8/js/anychart-ui.min.js"></script>
<script src="https://cdn.anychart.com/releases/v8/js/anychart-exports.min.js"></script>
<script src="https://cdn.anychart.com/releases/v8/js/anychart-sankey.min.js"></script>
<link rel="stylesheet" href="https://cdn.anychart.com/releases/v8/css/anychart-ui.min.css"/>
<link rel="stylesheet" href="https://cdn.anychart.com/releases/v8/fonts/css/anychart.min.css"/>
</head>
<body>
<div id="container"></div>
<script>
anychart.onDocumentReady(function() {
var data = anychart.data.set({{ chartData }});
var mapping = data.mapAs({from: "from_node", to: "to_node", weight: "flow_value"});
var chart = anychart.sankey(mapping);
chart.title({{ chartTitle }});
// set chart's padding
chart.padding(10, 10, 30, 10);
// set nodes width and padding
chart.nodeWidth(100);
chart.nodePadding(30);
// Set flow's normal and hovered fill
chart.flow({
normal: {
fill: '#DFE0DF .3',
},
hovered: {
fill: '#DFE0DF .9'
}
});
// Set flow's normal and hovered fill
chart.node({
normal: {
fill: function() {
return {
keys: [anychart.color.lighten(this.sourceColor, .3), '.1 ' + anychart.color.lighten(this.sourceColor, .3), '.1 #FFFFFF'],
angle: -90
}
},
stroke: '#bbb'
},
hovered: {
fill: function() {
return {
keys: [anychart.color.darken(this.sourceColor, .3), '.1 ' + anychart.color.darken(this.sourceColor, .3), '.1 #FFFFFF'],
angle: -90
}
},
stroke: '#666'
}
});
chart.container("container");
chart.draw();
});
</script>
</body>
</html>