-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprogress.js
executable file
·45 lines (42 loc) · 935 Bytes
/
progress.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
import React, { Component } from 'react';
import { Progress, Header } from 'semantic-ui-react';
class prog extends Component{
constructor(props){
super(props);
}
render(){
var data = this.props.data;
var label = this.props.front["labels"];
var obj = [];
var i = 0;
while (data[i]){
obj[i] = {};
obj[i]["data"] = data[i];
if (label[i])
obj[i]["label"] = label[i];
else
obj[i]["label"] = "";
i++;
}
obj.sort(function(a, b){
return a["data"] < b["data"];
})
i = 0;
return (
<div>
<Header className={"centered"} as={"h3"}> {this.props.title} </Header>
{Object.keys(obj).map(key => {
i++;
if (i < 6){
return (
<Progress color={"blue"} value={obj[key]["data"]} total={obj[0]["data"]} progress='percent' key={i} precision={0} label={obj[key]["label"]}/>
)
} else {
return (null);
}
})}
</div>
)
}
}
export default prog;