-
Notifications
You must be signed in to change notification settings - Fork 0
/
charts.py
61 lines (58 loc) · 2.35 KB
/
charts.py
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
from streamlit_echarts import st_echarts
import random
import string
import pandas as pd
def render_ring_gauge(weapon_data, max_dps, max_rof, max_recoil):
option = {
"series": [
{
"type": "gauge",
"startAngle": 90,
"endAngle": -270,
"pointer": {"show": False},
"progress": {
"show": True,
"overlap": False,
"roundCap": True,
"clip": False,
"itemStyle": {"borderWidth": 1, "borderColor": "#464646"},
},
"axisLine": {"lineStyle": {"width": 22}},
"splitLine": {"show": False, "distance": 0, "length": 10},
"axisTick": {"show": False},
"axisLabel": {"show": False, "distance": 50},
"data": [
{
"value": round((int(weapon_data['DPS'])/max_dps)*100),
"name": "DPS",
"title": {"offsetCenter": ["0%", "35%"], "color": '#FAFAFA'},
"detail": {"offsetCenter": ["0%", "51%"],},
},
{
"value": round((int(weapon_data['RoF'])/max_rof)*100),
"name": "RoF",
"title": {"offsetCenter": ["0%", "-5%"], "color": '#FAFAFA'},
"detail": {"offsetCenter": ["0%", "11%"]},
},
{
"value": round((int(weapon_data['Recoil'])/max_recoil)*100),
"name": "Recoil",
"title": {"offsetCenter": ["0%", "-50%"], "color": '#FAFAFA'},
"detail": {"offsetCenter": ["0%", "-34%"]},
},
],
#"title": {"fontSize": 14},
"detail": {
"width": 50,
"height": 9,
"fontSize": 13,
"color": '#FAFAFA',
"borderColor": "auto",
"borderRadius": 20,
"borderWidth": 1,
"formatter": "{value}%",
},
}
]
}
st_echarts(option, height="300px", key = ''.join(random.choice(string.ascii_lowercase) for i in range(12)))