本文整理汇总了Python中Graph.html方法的典型用法代码示例。如果您正苦于以下问题:Python Graph.html方法的具体用法?Python Graph.html怎么用?Python Graph.html使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Graph
的用法示例。
在下文中一共展示了Graph.html方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: section_HTML
# 需要导入模块: import Graph [as 别名]
# 或者: from Graph import html [as 别名]
def section_HTML(self, section_type):
section_type_name = section_name(section_type)
FILE = open(user_directory(self.name, self.c) + DIR_SEP + section_type_name.lower() + "_report" + ".html", "w")
lines = []
index = 1
graph_index = 1
scores = self.average_scores()
s1 = []
graphs = []
#calculate all scores
for test in self.tests_taken:
s1.append([index,test.score_summary.section_scores[section_type]])
index += 1
g = Graph(section_type_name + " Score Performance", graph_index, s1)
type_dict = section_type_dict(section_type)
for i in range(1, len(type_dict) + 1):
key = section_type_name[0] + str(i)
data = []
graph_index += 1
for test in self.tests_taken:
data.append(div(test.data.data[section_type].stats[key].c, test.data.data[section_type].stats[key].t) * 100)
graphs.append(Graph(type_dict[key], graph_index, data))
#HTML opener
lines.append('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">' + endl)
lines.append('<html xmlns="http://www.w3.org/1999/xhtml">' + endl)
lines.append('<head>')
lines.append('<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />' + endl)
lines.append('<link rel="stylesheet" type="text/css" href="../../../HTML/style.css" />' + endl)
lines.append('<title>' + section_type_name + ' Score Report</title>' + endl)
lines += g.head()
lines.append('</head>' + endl)
lines.append('<body>' + endl)
lines.append('<div id="page">' + endl)
lines.append('<div id="header">' + endl)
lines.append('<img src="../../../HTML/EliteLogo.png" width="35%" alt="Excelerate" />' + endl)
lines.append('</div>' + endl)
lines.append('</div>' + endl)
lines.append('<div id="content">' + endl)
lines.append('<div id="container">' + endl)
lines.append('<div id="main">' + endl)
lines.append('<div id="menu">' + endl)
lines.append('<h2 style="text-align:center;">' + section_type_name + SPACE + 'Analytics Report: ' + self.name + '</h2>' + endl)
lines.append('</div>' + endl)
lines.append('<div id="text">' + endl)
#Average Results
lines.append('<h1>' + section_type_name + ' Analytics</h1>' + endl)
lines.append('<hr color="#BBBBBB" size="2" width="100%">' + endl)
#Overall Graph
lines += g.html()
lines.append("<p>This is your performance in the " + section_type_name + " section of the last " + str(len(self.tests_taken)) + " tests you have taken. The more comprehensive analysis of questions correct in each type is found below.</p>")
#Average Results
lines.append('<h1>Question Type Analytics</h1>' + endl)
lines.append('<hr color="#BBBBBB" size="2" width="100%">' + endl)
#Print the type analysis as well
i = 1
for graph in graphs:
lines += graph.html(True)
lines.append('<p><b><font color = "' + self.data.data[section_type].stats[section_type_name[0] + str(i)].color() +'">' + type_dict[section_type_name[0] + str(i)] + "</b> " + str(self.data.data[section_type].stats[section_type_name[0]+str(i)]) + '</p>')
i+=1
lines.append('<hr color="#4169EF" size="1" width="90%">' + endl)
#lines.append("<br>" + endl)
#Footer
lines.append('<br>' + endl)
lines.append('</div>' + endl)
lines.append('</div>' + endl)
lines.append('</div>' + endl)
lines.append('<div class="clear"></div>' + endl)
lines.append('<div id="footer">' + endl)
lines.append('<p><a>' + self.name + SPACE + section_type_name + SPACE +' Report</a></p>' + endl)
lines.append('</div>' + endl)
lines.append('</div>' + endl)
lines += g.body()
lines.append('</body>' + endl)
lines.append('</html>' + endl)
lines.append(endl)
FILE.writelines(lines)
FILE.close()
示例2: simple_HTML
# 需要导入模块: import Graph [as 别名]
# 或者: from Graph import html [as 别名]
def simple_HTML(self):
FILE = open(user_directory(self.name, self.c) + DIR_SEP + "simple_report" + ".html", "w")
lines = []
index = 1
scores = self.average_scores()
s1 = []
#calculate all scores
for test in self.tests_taken:
s1.append([index,test.score_summary.total_score()])
index += 1
#graph js
g = Graph("Overall Score Performance", 1, s1)
#HTML opener
lines.append('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">' + endl)
lines.append('<html xmlns="http://www.w3.org/1999/xhtml">' + endl)
lines.append('<head>')
lines.append('<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />' + endl)
lines.append('<link rel="stylesheet" type="text/css" href="../../../HTML/style.css" />' + endl)
lines.append('<title>Simple Score Report</title>' + endl)
lines += g.head()
lines.append('</head>' + endl)
lines.append('<body>' + endl)
lines.append('<div id="page">' + endl)
lines.append('<div id="header">' + endl)
lines.append('<img src="../../../HTML/EliteLogo.png" width="35%" alt="Excelerate" />' + endl)
lines.append('</div>' + endl)
lines.append('</div>' + endl)
lines.append('<div id="content">' + endl)
lines.append('<div id="container">' + endl)
lines.append('<div id="main">' + endl)
lines.append('<div id="menu">' + endl)
lines.append('<h2 style="text-align:center;">Simple Report: ' + self.name + '</h2>' + endl)
lines.append('</div>' + endl)
lines.append('<div id="text">' + endl)
#Qualitative Performance
lines.append('<h1>Qualitative Performance</h1>' + endl)
lines.append('<p><b>Overall Aptitude:</b><font color = "' + overall_qualitative_color(scores[0]) + '"> ' + overall_qualitative(scores[0]) + '</font></p>' + endl)
lines.append('<p><b>Writing Performance:</b><font color = "' + qualitative_color(scores[2]) + '"> ' + qualitative(scores[2]) + '</font></p>' + endl)
lines.append('<p><b>Reading Performance:</b><font color = "' + qualitative_color(scores[1]) + '"> ' + qualitative(scores[1]) + '</font></p>' + endl)
lines.append('<p><b>Math Performance:</b><font color = "' + qualitative_color(scores[3]) + '"> ' + qualitative(scores[3]) + '</font></p>' + endl)
lines.append('<p><b>Essay Performance:</b> Unknown</p>' + endl)
lines.append('<p><i>Here are the details regarding the scores. Average scores are between 500 to 600. All scores above average are recorded as proficient and all scores below are noted as poor. Unknown scores have no records.</i></p>' + endl)
lines.append('<hr color="#BBBBBB" size="2" width="100%">' + endl)
#Average Results
lines.append('<h1>Average Results</h1>' + endl)
lines.append('<p><b>Total Score:</b><font color = "' + overall_qualitative_color(scores[0]) + '"> ' + str(scores[0]) + '/2400</font></p>' + endl)
lines.append('<p><b>Average Writing Score:</b><font color = "' + qualitative_color(scores[2]) + '"> ' + str(scores[2]) + '/800</font></p>' + endl)
lines.append('<p><b>Average Reading Score:</b><font color = "' + qualitative_color(scores[1]) + '"> ' + str(scores[1]) + '/800</font></p>' + endl)
lines.append('<p><b>Average Math Score:</b><font color = "' + qualitative_color(scores[3]) + '"> ' + str(scores[3]) + '/800</font></p>' + endl)
lines.append('<p><b>Average Essay Score:</b> ??/12</p>' + endl)
lines.append('<p><b>Tests Taken:</b> ' + str(len(self.tests_taken)) + '</p>' + endl)
lines.append('<hr color="#BBBBBB" size="2" width="100%">' + endl)
#Previous Test History
"""lines.append('<h1>Previous Test History</h1>' + endl)
for test in self.tests_taken:
lines.append('<p><b>Test ID:</b> ' + test.test_id + '</p>' + endl)
lines.append('<p><b>Total:</b> ' + str(test.score_summary.total_score())+'</p>' + endl)
lines.append('<p><b>Writing:</b> ' + str(test.score_summary.section_scores[WRITING_TYPE]) +'</p>' + endl)
lines.append('<p><b>Reading:</b> ' + str(test.score_summary.section_scores[READING_TYPE]) +'</p>' + endl)
lines.append('<p><b>Math:</b> ' + str(test.score_summary.section_scores[MATH_TYPE]) +'</p>' + endl)
lines.append('<br>' + endl)
lines.append('<hr color="#BBBBBB" size="2" width="100%">' + endl)"""
#Overall Graph
lines.append('<h1>Previous Test History</h1>' + endl)
lines += g.html(False, False)
lines.append('<br><hr color="#BBBBBB" size="2" width="100%">' + endl)
#Cram
cram = self.cram()
lines.append('<h1>Quick Advice</h1>' + endl)
if (cram[READING_TYPE][0] != None):
type_name = READING_TYPE_DICT[cram[READING_TYPE][0]]
lines.append("<h3><i>Reading Weakness:</i></h3>" + endl)
lines.append(paropen + "Your weakest reading section is " + type_name + " as you are only scoring " + cram[READING_TYPE][1] + " in these questions.")
if (cram[WRITING_TYPE][0] != None):
lines.append("<h3><i>Writing Weakness:</i></h3>" + endl)
type_name = WRITING_TYPE_DICT[cram[WRITING_TYPE][0]]
lines.append(paropen + "Your weakest writing section is " + type_name + " as you are only scoring " + cram[WRITING_TYPE][1] + " in these questions.")
if (cram[MATH_TYPE][0] != None):
lines.append("<h3><i>Math Weakness:</i></h3>" + endl)
type_name = MATH_TYPE_DICT[cram[MATH_TYPE][0]]
lines.append(paropen + "Your weakest math section is " + type_name + " as you are only scoring " + cram[MATH_TYPE][1] + " in these questions.")
#Footer
lines.append('<br>' + endl)
lines.append('</div>' + endl)
lines.append('</div>' + endl)
#.........这里部分代码省略.........