-
Notifications
You must be signed in to change notification settings - Fork 0
/
GraphCrafting(Second_Graph).py
49 lines (40 loc) · 1.52 KB
/
GraphCrafting(Second_Graph).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
import plotly.graph_objects as go
import plotly.offline as pyo
import json
import re
with open("data\config.json") as g:
config = json.load(g)
SecondGraphPathHTML = config["SecondGraphPathHTML"]
SecondGraphPathPNG = config["SecondGraphPathPNG"]
categories = config["SecondCategories"]
g.close()
categories = [*categories, categories[0]]
with open("data\data2.json", "r") as f:
content = json.load(f)
MaxRow = content["MaxRow"]
print(MaxRow)
MaxColumn = content["MaxColumn"]
for i in range(3, MaxRow+2):
j = str(i)
Class = content["Class" + j]
ClassNo = content["ClassNo" + j]
data = content["data" + j]
date = content["date" + j]
year = content["year" + j]
date = re.sub(r'[\\/*?:"<>|]', "_", date)
year = re.sub(r'[\\/*?:"<>|]', "_", year)
print(i)
print(data)
fig = go.Figure(
data=[
go.Scatterpolar(r=data, theta=categories, fill='toself', name='Marks'),
],
layout=go.Layout(
title=go.layout.Title(text=Class + ClassNo + " " + 'Different Types of Questions Report: ' + year),
polar={'radialaxis': {'visible': True, 'range': [0, 100]}},
showlegend=True,
)
)
pyo.plot(fig, filename=SecondGraphPathHTML + Class + ClassNo + "&&" + year + date + ".html", auto_open=False)
fig.write_image(SecondGraphPathPNG + Class + ClassNo + " " + year + "&&" + date + ".png", format="png")
print("Finished " + Class + ClassNo + "Report: " + year)