forked from madmaze/pyNmonAnalyzer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinteractiveReport.tpl.html
100 lines (93 loc) · 2.07 KB
/
interactiveReport.tpl.html
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
<html>
<head>
<title>pyNmonAnalyzer Interactive Report [__datetime__] </title>
<script type="text/javascript"
src="[__dygraphLoc__]"></script>
</head>
<body>
<style>
h2 {
font-family: sans-serif;
font-style: normal;
font-variant: normal;
font-weight: bold;
font-size: medium;
}
</style>
[__plots__]
<script type="text/javascript">
function setVisByColumnHeading(g, headings, labels){
vis=[]
// remove timestamp column
headings.splice(0,1);
// figure out which columns we do and do not want
for( i in headings){
if(labels.indexOf(headings[i]) >= 0){
vis.push(true);
} else {
vis.push(false);
}
}
// Update options
g.updateOptions({
visibility:vis
});
}
var dataSources=[
[__dataSources__]
];
var specialOpts=[
[__specialOpts__]
];
var displayCols=[
[__displayCols__]
];
var gs = [];
var blockRedraw = false;
for( x in dataSources){
console.log("creating.. "+dataSources[x]);
gs.push(new Dygraph(
document.getElementById("plot"+x),
dataSources[x], // path to CSV file
{
rollPeriod: 2,
showRoller: false,
legend: 'always',
labelsDivStyles: { 'textAlign': 'right' },
showRangeSelector: true,
rangeSelectorHeight: 50,
rangeSelectorPlotStrokeColor: 'black',
rangeSelectorPlotFillColor: 'gray',
drawCallback: function(me, initial) {
if (blockRedraw){
return;
}
blockRedraw = true;
if(initial) {
console.log("Initial.. " + gs.length);
for (var i = 0; i < gs.length; i++) {
if(gs[i] == me){
setVisByColumnHeading(gs[i], gs[i].getLabels(), displayCols[i]);
gs[i].updateOptions(specialOpts[i]);
}
}
blockRedraw = false;
return;
}
var range = me.xAxisRange();
for (var j = 0; j < gs.length; j++) {
if (gs[j] == me) continue;
gs[j].updateOptions( {
dateWindow: range
} );
}
blockRedraw = false;
}
} // options
)
);
}
</script>
<center>Powered by <a href="http://dygraphs.com">dygraphs.js</a></center>
</body>
</html>