-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgraph2.js
102 lines (102 loc) · 2.19 KB
/
graph2.js
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
function getDataSet() {
return sold;
}
function getDataSet1(){
return syoung;
}
function getDataSet2(){
return rold;
}
function getDataSet21(){
return ryoung;
}
function getDataSet3(){
return dold;
}
function getDataSet31(){
return dyoung;
}
function getDataSet4(){
return iold;
}
function getDataSet41(){
return iyoung;
}
var layout2 = {
plot_bgcolor:"#F5F2F2",
paper_bgcolor:"#F5F2F2",
barmode:'stack',
bargroupgap: 1,
autosize:false,
margin: {
l: 50,
r: 50,
b: 50,
t: 50,
pad: 10
},
width: 800,
height:300,
xaxis: {
automargin : false,
range: [-1,3],
title: {
text: 'Age of Person',
font: {
family: 'sans-serif,Courier New, monospace',
size: 16,
color: '#3B3636'
}
},
},
yaxis: {
automargin : false,
title: {
text: 'People Count',
font: {
family: 'sans-serif,Courier New, monospace',
size: 16,
color: '#3B3636'
}
}
},
};
setInterval(function() {
Plotly.react('chart2',[{
x:['Old','Young'],
y:[getDataSet(),getDataSet1()],
width: [0.6,0.6],
name: 'Susceptible',
type:'bar',
marker: {
color:'#41E515'
}
},{
x:['Old','Young'],
y:[getDataSet4(),getDataSet41()],
width: [0.6,0.6],
name: 'Infected',
type: 'bar',
marker: {
color:'#E51515'
}
},{
x:['Old','Young'],
y:[getDataSet2(),getDataSet21()],
width: [0.6,0.6],
name: 'Recovered',
type: 'bar',
marker: {
color:'#0983EA'
}
},{
x:['Old','Young'],
y:[getDataSet3(),getDataSet31()],
width: [0.6,0.6],
name: 'Dead',
type: 'bar',
marker: {
color:'#534F5A'
}
}],layout2);
}, 1000);