def per_build_time(self): builds = Builds() builds.builds = self.builds chart = Chart() values, labels, max_time = builds.per_build_time(); element = Chart() element.type = "bar_glass" element.values = values chart.elements = [element] chart.y_axis = { "min": 0, "max": max_time + 10, "steps": 50} chart.x_axis = {"labels" : {"labels" : labels, "visible-steps": 2, "rotate": 90}} return chart.create()
def build_times(self): chart = Chart() element = Chart() element.type = "line" element.dot_style = { "type": "dot" } element.width = 2 element.colour = "#0000ff" element.fill = "#1C9E05" element.fill_alpha = 0.7 builds = Builds() builds.builds = self.builds values, min_date, max_date, max_time = builds.build_times() element.values = values chart.elements = [element] all_percentage = [] chart.y_axis = { "min": 0, "max": max_time + 10, "steps": 50, "labels" : {"steps" : 20}} chart.x_axis = { "min": min_date, "max": max_date, "steps": 86400, "labels": { "text": "#date:l jS, M Y#", "steps": 86400, "visible-steps": 2, "rotate": 90 }} chart.title = { "text": "Build time over time."} return chart.create()
def successful_rate(self): chart = Chart() element = Chart() element.type = "line" element.dot_style = { "type": "dot" } element.width = 2 element.colour = "#C4B86A" element.fill = "#1C9E05" element.fill_alpha = 0.7 builds = Builds() builds.builds = self.builds values, min_date, max_date = builds.pass_rate_by_day() element.values = values chart.elements = [element] all_percentage = [] for i in range(110): all_percentage.append(str(i) + "%"); chart.y_axis = { "min": 0, "max": 110, "steps": 10, "labels" : {"labels" : all_percentage, "steps" : 20}} chart.x_axis = { "min": min_date, "max": max_date, "steps": 86400, "labels": { "text": "#date:l jS, M Y#", "steps": 86400, "visible-steps": 2, "rotate": 90 }} chart.title = { "text": "Pass rate over time."} return chart.create()
def pass_rate(self): builds = Builds() builds.builds = self.builds total = Build.total(self.project_id) passed = Build.passed_count(self.project_id) failed = total - passed chart = Chart() element1 = Chart() element1.values = [passed, failed] element1.type = "pie" element1.alpha = 0.6 element1.angle = 35 element1.tip = '#val# of #total#<br>#percent# of 100%'; element1.colours = ['#1C9E05','#FF368D'] chart.elements = [element1] chart.title = {"text": str(builds.avg_runs()) + ' Runs/Day', "style": "{font-size: 15px; font-family: Times New Roman; font-weight: bold; color: #4183C4; text-align: center;}" } chart.bg_colour = "#FFFFFF" return chart.create()