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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Chart | Storperf</title>
<link rel="stylesheet" href="{{ url_for('static', filename='css/bootstrap.min.css') }}">
<script src="{{ url_for('static', filename='js/jquery-2.1.3.min.js') }}"></script>
<script src="{{ url_for('static', filename='js/bootstrap.min.js') }}"></script>
<script src="{{ url_for('static', filename='js/jquery.bootpag.min.js') }}"></script>
<script src="{{ url_for('static', filename='js/plotly-latest.min.js') }}"></script>
<script src="{{ url_for('static', filename='js/Chart.min.js') }}"></script>
<style>
.table td {
text-align: left;
}
</style>
</head>
<body>
<div class="container">
<div id="content"><strong>Loading...</strong>
</div>
<center>
<div id="page-selection"></div>
</center>
</div>
<script>
data = {{ data | tojson | safe }};
page = [];
results = data.results;
if (results == undefined) {
details = data.details;
} else {
details = results[0].details;
}
metrics = details.metrics;
report_data = details.report_data;
for (var key in report_data) {
for (var test in report_data[key]) {
var text = "";
var series = [];
var average;
for (var status in report_data[key][test]) {
text = '<div class="row text-center lead">';
text += "<h3>" + key + "</h3>" + "<br>";
text += "<strong><u>" + test + "</strong>" + "<br>";
text += "<strong>" + status + "</strong>" + "<br>";
text += "<table class=' table table-striped'>";
for (var values in report_data[key][test][status]) {
text += "<tr>";
value_data = report_data[key][test][status][values];
if (values == "average") {
average = value_data;
text += "<td width='50%'>" + values + "</td><td width='50%'>" + value_data + "</td>";
} else if (values == "series") {
text += "<td width='50%'>" + values + "</td><td width='50%'> ";
var len = value_data.length;
series = value_data;
for (var i = 0; i < len; i++) {
text += "[" + value_data[i] + "]";
if (i != len - 1)
text += ",";
}
text += "</td>";
} else {
text += "<td width='50%'>" + values + "</td><td width='50%'>" + value_data + "</td>";
}
text += "</tr>";
}
page.push([text, series, average]);
}
}
}
function content_display(num) {
var text = page[num - 1][0];
var array = page[num - 1][1];
var average = page[num - 1][2];
var final_array = [];
var graph_label = []
for (var i = 0; i < array.length; i++) {
graph_label = graph_label.concat(i + 1);
}
for (var i = 0; i < array.length; i++) {
final_array = final_array.concat(array[i][1]);
}
var index = num - 1;
var graphID = "graph" + index;
text += "<tr><td>Graph</td><td><div id='" + graphID + "' style='display: block; height:400px; width 400px;'></div></td></tr>";
text += "</table></div>";
$("#content").html(text);
var plot = {
x: graph_label,
y: final_array,
type: "lines",
name: "Plot"
};
var avg_plus = {
x: graph_label,
y: Array(array.length).fill(1.2 * average),
type: "lines",
name: "avg_plus",
line: {
dash: "dashdot",
width: 2
}
};
var avg_minus = {
x: graph_label,
y: Array(array.length).fill(0.8 * average),
type: "lines",
name: "avg_minus",
line: {
dash: "dashdot",
width: 2
}
};
Plotly.newPlot(graphID, [plot, avg_plus, avg_minus]);
}
content_display(1);
$('#page-selection').bootpag({
total: page.length
}).on("page", function(event, num) {
content_display(num);
});
</script>
</body>
</html>
|