rrd-grapher 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +9 -0
- data/.rvmrc +1 -0
- data/Gemfile +11 -0
- data/Guardfile +123 -0
- data/README.md +91 -0
- data/Rakefile +42 -0
- data/example_app/Gemfile +9 -0
- data/example_app/Guardfile +18 -0
- data/example_app/app.rb +38 -0
- data/example_app/assets/javascripts/available_rrds.coffee +13 -0
- data/example_app/assets/javascripts/collectd.coffee +48 -0
- data/example_app/config.ru +9 -0
- data/example_app/public/.gitignore +1 -0
- data/example_app/public/chosen/chosen-sprite.png +0 -0
- data/example_app/public/chosen/chosen.css +340 -0
- data/example_app/public/chosen/chosen.jquery.js +786 -0
- data/example_app/public/chosen/chosen.jquery.min.js +10 -0
- data/example_app/public/javascripts/available_rrds.js +16 -0
- data/example_app/public/javascripts/collectd.js +64 -0
- data/example_app/public/javascripts/jquery.timeago.js +148 -0
- data/example_app/public/stylesheets/Aristo/images/bg_fallback.png +0 -0
- data/example_app/public/stylesheets/Aristo/images/icon_sprite.png +0 -0
- data/example_app/public/stylesheets/Aristo/images/progress_bar.gif +0 -0
- data/example_app/public/stylesheets/Aristo/images/slider_handles.png +0 -0
- data/example_app/public/stylesheets/Aristo/images/ui-icons_222222_256x240.png +0 -0
- data/example_app/public/stylesheets/Aristo/images/ui-icons_454545_256x240.png +0 -0
- data/example_app/public/stylesheets/Aristo/theme.css +738 -0
- data/example_app/views/available_rrds.haml +26 -0
- data/example_app/views/collectd.haml +30 -0
- data/example_app/views/layout.haml +19 -0
- data/example_app/views/stylesheets/available_rrds.scss +7 -0
- data/example_notifier/Gemfile +2 -0
- data/example_notifier/notifier.rb +25 -0
- data/lib/rrd-grapher/assets/javascripts/app-dev.js +20 -0
- data/lib/rrd-grapher/assets/javascripts/app.js +20 -0
- data/lib/rrd-grapher/assets/javascripts/classes/format.coffee +35 -0
- data/lib/rrd-grapher/assets/javascripts/classes/graph.coffee +306 -0
- data/lib/rrd-grapher/assets/javascripts/classes/graph_definition.coffee +216 -0
- data/lib/rrd-grapher/assets/javascripts/classes/serie.coffee +13 -0
- data/lib/rrd-grapher/assets/javascripts/classes/size.coffee +5 -0
- data/lib/rrd-grapher/assets/javascripts/classes/static_line.coffee +44 -0
- data/lib/rrd-grapher/assets/javascripts/classes/time.coffee +17 -0
- data/lib/rrd-grapher/notifier/alarm_manager.rb +190 -0
- data/lib/rrd-grapher/notifier/alarm_trigger.rb +187 -0
- data/lib/rrd-grapher/notifier/alarms.rb +79 -0
- data/lib/rrd-grapher/notifier/collectdrb.rb +86 -0
- data/lib/rrd-grapher/notifier/data_struct.rb +46 -0
- data/lib/rrd-grapher/notifier/default_user_handler.rb +36 -0
- data/lib/rrd-grapher/notifier/parsers/bindata_parser.rb +144 -0
- data/lib/rrd-grapher/notifier/parsers/ruby_parser.rb +134 -0
- data/lib/rrd-grapher/notifier/structures.rb +80 -0
- data/lib/rrd-grapher/notifier.rb +87 -0
- data/lib/rrd-grapher/public/favicon.ico +0 -0
- data/lib/rrd-grapher/public/javascripts/app-dev.js +13709 -0
- data/lib/rrd-grapher/public/javascripts/app.js +4057 -0
- data/lib/rrd-grapher/public/javascripts/backbone/backbone.js +1155 -0
- data/lib/rrd-grapher/public/javascripts/backbone/backbone.min.js +32 -0
- data/lib/rrd-grapher/public/javascripts/backbone/underscore.js +841 -0
- data/lib/rrd-grapher/public/javascripts/backbone/underscore.min.js +27 -0
- data/lib/rrd-grapher/public/javascripts/classes/format.js +42 -0
- data/lib/rrd-grapher/public/javascripts/classes/graph.js +360 -0
- data/lib/rrd-grapher/public/javascripts/classes/graph_definition.js +298 -0
- data/lib/rrd-grapher/public/javascripts/classes/serie.js +32 -0
- data/lib/rrd-grapher/public/javascripts/classes/size.js +7 -0
- data/lib/rrd-grapher/public/javascripts/classes/static_line.js +48 -0
- data/lib/rrd-grapher/public/javascripts/classes/time.js +17 -0
- data/lib/rrd-grapher/public/javascripts/flot/.gitignore +4 -0
- data/lib/rrd-grapher/public/javascripts/flot/excanvas.min.js +1 -0
- data/lib/rrd-grapher/public/javascripts/flot/jquery.colorhelpers.min.js +1 -0
- data/lib/rrd-grapher/public/javascripts/flot/jquery.flot.crosshair.min.js +1 -0
- data/lib/rrd-grapher/public/javascripts/flot/jquery.flot.fillbetween.min.js +1 -0
- data/lib/rrd-grapher/public/javascripts/flot/jquery.flot.image.min.js +1 -0
- data/lib/rrd-grapher/public/javascripts/flot/jquery.flot.js +2604 -0
- data/lib/rrd-grapher/public/javascripts/flot/jquery.flot.navigate.min.js +1 -0
- data/lib/rrd-grapher/public/javascripts/flot/jquery.flot.pie.min.js +1 -0
- data/lib/rrd-grapher/public/javascripts/flot/jquery.flot.resize.min.js +1 -0
- data/lib/rrd-grapher/public/javascripts/flot/jquery.flot.selection.js +345 -0
- data/lib/rrd-grapher/public/javascripts/flot/jquery.flot.selection.min.js +1 -0
- data/lib/rrd-grapher/public/javascripts/flot/jquery.flot.stack.min.js +1 -0
- data/lib/rrd-grapher/public/javascripts/flot/jquery.flot.symbol.min.js +1 -0
- data/lib/rrd-grapher/public/javascripts/flot/jquery.flot.threshold.min.js +1 -0
- data/lib/rrd-grapher/public/javascripts/jquery/jquery-1.6.2.js +8981 -0
- data/lib/rrd-grapher/public/javascripts/jquery/jquery-1.6.2.min.js +18 -0
- data/lib/rrd-grapher/public/javascripts/jquery/jquery-ui-1.8.11.min.js +783 -0
- data/lib/rrd-grapher/public/javascripts/jquery/jquery.showtime.js +63 -0
- data/lib/rrd-grapher/public/javascripts/jquery/jquery.tpl.min.js +10 -0
- data/lib/rrd-grapher/resources.rb +14 -0
- data/lib/rrd-grapher/rrd.rb +238 -0
- data/lib/rrd-grapher/rrd_server.rb +78 -0
- data/lib/rrd-grapher/version.rb +4 -0
- data/lib/rrd-grapher/views/stylesheets/app.scss +111 -0
- data/lib/rrd-grapher.rb +12 -0
- data/rrd-grapher.gemspec +47 -0
- data/spec/common.rb +70 -0
- data/spec/data/myrouter.rrd +0 -0
- data/spec/data/subdata.rrd +0 -0
- data/spec/data/test.rrd +0 -0
- data/spec/factories.rb +23 -0
- data/spec/javascripts/helpers/jasmine-jquery-1.3.0.js +283 -0
- data/spec/javascripts/source/format_spec.coffee +18 -0
- data/spec/javascripts/source/graph_def_spec.coffee +27 -0
- data/spec/javascripts/source/graph_spec.coffee +63 -0
- data/spec/javascripts/source/serie_spec.coffee +28 -0
- data/spec/javascripts/source/static_line_spec.coffee +13 -0
- data/spec/javascripts/source/time_spec.coffee +26 -0
- data/spec/javascripts/support/jasmine.yml +78 -0
- data/spec/javascripts/support/jasmine_config.rb +23 -0
- data/spec/javascripts/support/jasmine_runner.rb +32 -0
- data/spec/unit/alarm_manager_spec.rb +252 -0
- data/spec/unit/alarm_trigger_spec.rb +26 -0
- data/spec/unit/data_struct_spec.rb +55 -0
- data/spec/unit/notifier_spec.rb +45 -0
- data/spec/unit/parsers/bindata_parser_spec.rb +184 -0
- data/spec/unit/parsers/ruby_parser_spec.rb +184 -0
- data/spec/unit/rrd_spec.rb +50 -0
- data/spec/unit/structures_spec.rb +28 -0
- data/tests/4series.rrd +0 -0
- data/tests/analyze_rrd.rb +62 -0
- data/tests/exact.rrd +0 -0
- data/tests/exact2.rrd +0 -0
- data/tests/filler.rb +46 -0
- metadata +414 -0
@@ -0,0 +1,298 @@
|
|
1
|
+
(function() {
|
2
|
+
var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
|
3
|
+
for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
|
4
|
+
function ctor() { this.constructor = child; }
|
5
|
+
ctor.prototype = parent.prototype;
|
6
|
+
child.prototype = new ctor;
|
7
|
+
child.__super__ = parent.prototype;
|
8
|
+
return child;
|
9
|
+
}, __slice = Array.prototype.slice, __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
|
10
|
+
window.GraphController = (function() {
|
11
|
+
__extends(GraphController, Backbone.View);
|
12
|
+
function GraphController() {
|
13
|
+
GraphController.__super__.constructor.apply(this, arguments);
|
14
|
+
}
|
15
|
+
GraphController.prototype.initialize = function() {
|
16
|
+
return this.pages = this.options.pages;
|
17
|
+
};
|
18
|
+
return GraphController;
|
19
|
+
})();
|
20
|
+
window.GraphPage = (function() {
|
21
|
+
function GraphPage(container, panel_container, host) {
|
22
|
+
this.container = container;
|
23
|
+
this.panel_container = panel_container;
|
24
|
+
this.host = host;
|
25
|
+
this.graphs = [];
|
26
|
+
this.autorefresh_timer = null;
|
27
|
+
this.autorefresh_checkbox = $("#autorefresh", this.panel_container);
|
28
|
+
this.linked_zoom_checkbox = $("#linkedzoom", this.panel_container);
|
29
|
+
this.date_select = $("#dateselect", this.panel_container);
|
30
|
+
this.interval = 15 * 60;
|
31
|
+
this.offset = 60 * 1000;
|
32
|
+
}
|
33
|
+
GraphPage.prototype.addGraph = function() {
|
34
|
+
var args, class_name, g;
|
35
|
+
class_name = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
|
36
|
+
g = (function(func, args, ctor) {
|
37
|
+
ctor.prototype = func.prototype;
|
38
|
+
var child = new ctor, result = func.apply(child, args);
|
39
|
+
return typeof result === "object" ? result : child;
|
40
|
+
})(window[class_name], [this.container, this.host].concat(__slice.call(args)), function() {});
|
41
|
+
g.init();
|
42
|
+
g.bind("dblclick", __bind(function() {
|
43
|
+
this.set_simple_interval(this.interval);
|
44
|
+
return this.set_autorefresh(null);
|
45
|
+
}, this));
|
46
|
+
g.bind("plotselection", __bind(function(from, to) {
|
47
|
+
this.set_autorefresh(null);
|
48
|
+
if (this.linked_zoom_checkbox.attr("checked")) {
|
49
|
+
return this.set_interval(from, to);
|
50
|
+
}
|
51
|
+
}, this));
|
52
|
+
return this.graphs.push(g);
|
53
|
+
};
|
54
|
+
GraphPage.prototype.set_simple_interval = function(interval) {
|
55
|
+
var from, to;
|
56
|
+
this.interval = interval;
|
57
|
+
this.date_select.val("");
|
58
|
+
to = (new Date().getTime()) - this.offset;
|
59
|
+
to = to / 1000;
|
60
|
+
from = to - this.interval;
|
61
|
+
return this.set_interval(from, to);
|
62
|
+
};
|
63
|
+
GraphPage.prototype.set_interval = function(from, to) {
|
64
|
+
return $.each(this.graphs, function(i, g) {
|
65
|
+
g.set_interval(from, to);
|
66
|
+
return g.update_graph();
|
67
|
+
});
|
68
|
+
};
|
69
|
+
GraphPage.prototype.set_autorefresh = function(time) {
|
70
|
+
if (this.autorefresh_timer) {
|
71
|
+
window.clearInterval(this.autorefresh_timer);
|
72
|
+
this.autorefresh_timer = null;
|
73
|
+
}
|
74
|
+
if (time) {
|
75
|
+
this.autorefresh_checkbox.attr("checked", true);
|
76
|
+
return this.autorefresh_timer = window.setInterval((__bind(function() {
|
77
|
+
return this.set_simple_interval(this.interval);
|
78
|
+
}, this)), time);
|
79
|
+
} else {
|
80
|
+
return this.autorefresh_checkbox.attr("checked", false);
|
81
|
+
}
|
82
|
+
};
|
83
|
+
GraphPage.prototype.refresh = function() {
|
84
|
+
return this.set_simple_interval(this.interval);
|
85
|
+
};
|
86
|
+
return GraphPage;
|
87
|
+
})();
|
88
|
+
window.GraphDefinition = (function() {
|
89
|
+
function GraphDefinition(host, container, title, formatters, ymin) {
|
90
|
+
var limits;
|
91
|
+
this.host = host;
|
92
|
+
this.container = container;
|
93
|
+
this.title = title;
|
94
|
+
_.extend(this, Backbone.Events);
|
95
|
+
if (ymin) {
|
96
|
+
ymin = $.makeArray(ymin);
|
97
|
+
if (ymin.length === 1) {
|
98
|
+
limits = $.map(formatters, function() {
|
99
|
+
return [[0, ymin[0]]];
|
100
|
+
});
|
101
|
+
} else if (ymin.length === 2) {
|
102
|
+
limits = $.map(ymin, function(val) {
|
103
|
+
return [[0, val]];
|
104
|
+
});
|
105
|
+
}
|
106
|
+
} else {
|
107
|
+
limits = $.map(formatters, function() {
|
108
|
+
return [[0, 0]];
|
109
|
+
});
|
110
|
+
}
|
111
|
+
this.graph = new Graph({
|
112
|
+
"title": this.title,
|
113
|
+
"parent_container": this.container,
|
114
|
+
"formatters": formatters,
|
115
|
+
"limits": limits
|
116
|
+
});
|
117
|
+
this.graph.bind("dblclick", __bind(function() {
|
118
|
+
return this.trigger("dblclick");
|
119
|
+
}, this));
|
120
|
+
this.graph.bind("plotselection", __bind(function(from, to) {
|
121
|
+
return this.trigger("plotselection", from, to);
|
122
|
+
}, this));
|
123
|
+
}
|
124
|
+
GraphDefinition.prototype.init = function() {
|
125
|
+
return this.graph.create();
|
126
|
+
};
|
127
|
+
GraphDefinition.prototype.set_interval = function(from, to) {
|
128
|
+
return this.graph.set_interval(from, to);
|
129
|
+
};
|
130
|
+
GraphDefinition.prototype.update_graph = function() {
|
131
|
+
return this.graph.update_graph();
|
132
|
+
};
|
133
|
+
return GraphDefinition;
|
134
|
+
})();
|
135
|
+
window.NTPGraph = (function() {
|
136
|
+
__extends(NTPGraph, GraphDefinition);
|
137
|
+
function NTPGraph(container, host, remote_host, ymin) {
|
138
|
+
this.remote_host = remote_host;
|
139
|
+
if (ymin == null) {
|
140
|
+
ymin = null;
|
141
|
+
}
|
142
|
+
NTPGraph.__super__.constructor.call(this, host, container, "NTP", [Format.delay, Format.identity], ymin);
|
143
|
+
this.graph.addSerie("" + this.host + "/ntpd/time_offset-" + this.remote_host, "seconds", "Offset remote");
|
144
|
+
this.graph.addSerie("" + this.host + "/ntpd/time_offset-loop", "seconds", "Offset local");
|
145
|
+
this.graph.addSerie("" + this.host + "/ntpd/delay-" + this.remote_host, "seconds", "Delay remote");
|
146
|
+
this.graph.addSerie("" + this.host + "/ntpd/time_dispersion-" + this.remote_host, "seconds", "Dispertion remote");
|
147
|
+
this.graph.addSerie("" + this.host + "/ntpd/time_dispersion-LOCAL", "seconds", "Dispertion local");
|
148
|
+
}
|
149
|
+
return NTPGraph;
|
150
|
+
})();
|
151
|
+
window.CPUGraph = (function() {
|
152
|
+
__extends(CPUGraph, GraphDefinition);
|
153
|
+
function CPUGraph(container, host, cpu_index, ymin) {
|
154
|
+
this.cpu_index = cpu_index;
|
155
|
+
if (ymin == null) {
|
156
|
+
ymin = null;
|
157
|
+
}
|
158
|
+
CPUGraph.__super__.constructor.call(this, host, container, "CPU " + this.cpu_index, [Format.percent, Format.prcent], ymin);
|
159
|
+
this.graph.addSerie("" + this.host + "/cpu-" + this.cpu_index + "/cpu-user", 'value', 'User');
|
160
|
+
this.graph.addSerie("" + this.host + "/cpu-" + this.cpu_index + "/cpu-system", 'value', 'System');
|
161
|
+
this.graph.addSerie("" + this.host + "/cpu-" + this.cpu_index + "/cpu-interrupt", 'value', 'Interrupt');
|
162
|
+
}
|
163
|
+
return CPUGraph;
|
164
|
+
})();
|
165
|
+
window.DFGraph = (function() {
|
166
|
+
__extends(DFGraph, GraphDefinition);
|
167
|
+
function DFGraph(container, host, location, ymin) {
|
168
|
+
this.location = location;
|
169
|
+
if (ymin == null) {
|
170
|
+
ymin = null;
|
171
|
+
}
|
172
|
+
DFGraph.__super__.constructor.call(this, host, container, "Disk use (" + this.location + ")", [Format.size, Format.size], ymin);
|
173
|
+
this.graph.addSerie("" + this.host + "/df/df-" + this.location, 'used', 'Used');
|
174
|
+
this.graph.addSerie("" + this.host + "/df/df-" + this.location, 'free', 'Free');
|
175
|
+
}
|
176
|
+
return DFGraph;
|
177
|
+
})();
|
178
|
+
window.PingGraph = (function() {
|
179
|
+
__extends(PingGraph, GraphDefinition);
|
180
|
+
function PingGraph(container, host, label, destination, ymin) {
|
181
|
+
this.label = label;
|
182
|
+
this.destination = destination;
|
183
|
+
if (ymin == null) {
|
184
|
+
ymin = null;
|
185
|
+
}
|
186
|
+
PingGraph.__super__.constructor.call(this, host, container, "Ping " + this.label, [Format.delay, Format.identity], ymin);
|
187
|
+
this.graph.addSerie("" + this.host + "/ping/ping-" + this.destination, 'ping', 'Latency');
|
188
|
+
this.graph.addSerie("" + this.host + "/ping/ping_stddev-" + this.destination, 'value', 'stddev');
|
189
|
+
this.graph.addSerie("" + this.host + "/ping/ping_droprate-" + this.destination, 'value', 'Loss', 2);
|
190
|
+
}
|
191
|
+
return PingGraph;
|
192
|
+
})();
|
193
|
+
window.NetworkGraph = (function() {
|
194
|
+
__extends(NetworkGraph, GraphDefinition);
|
195
|
+
function NetworkGraph(container, host, interface, ymin) {
|
196
|
+
this.interface = interface;
|
197
|
+
if (ymin == null) {
|
198
|
+
ymin = null;
|
199
|
+
}
|
200
|
+
NetworkGraph.__super__.constructor.call(this, host, container, "Network Traffic (" + interface + ")", [Format.size, Format.size], ymin);
|
201
|
+
this.graph.addSerie("" + this.host + "/interface/if_octets-" + this.interface, "rx", "(" + this.interface + ") Bytes Received");
|
202
|
+
this.graph.addSerie("" + this.host + "/interface/if_octets-" + this.interface, "tx", "(" + this.interface + ") Bytes Sent");
|
203
|
+
}
|
204
|
+
return NetworkGraph;
|
205
|
+
})();
|
206
|
+
window.MemoryGraph = (function() {
|
207
|
+
__extends(MemoryGraph, GraphDefinition);
|
208
|
+
function MemoryGraph(container, host, os, ymin) {
|
209
|
+
if (ymin == null) {
|
210
|
+
ymin = null;
|
211
|
+
}
|
212
|
+
MemoryGraph.__super__.constructor.call(this, host, container, "Memory", [Format.size, Format.size], ymin);
|
213
|
+
if (os === "osx") {
|
214
|
+
this.graph.addSerie("" + this.host + "/memory/memory-active", "value", "Active");
|
215
|
+
this.graph.addSerie("" + this.host + "/memory/memory-free", "value", "Free");
|
216
|
+
this.graph.addSerie("" + this.host + "/memory/memory-inactive", "value", "Inactive");
|
217
|
+
this.graph.addSerie("" + this.host + "/memory/memory-wired", "value", "Wired");
|
218
|
+
} else if (os === "freebsd") {
|
219
|
+
this.graph.addSerie("" + this.host + "/memory/memory-active", "value", "Active");
|
220
|
+
this.graph.addSerie("" + this.host + "/memory/memory-cache", "value", "Cached");
|
221
|
+
this.graph.addSerie("" + this.host + "/memory/memory-free", "value", "Free");
|
222
|
+
this.graph.addSerie("" + this.host + "/memory/memory-inactive", "value", "Inactive");
|
223
|
+
this.graph.addSerie("" + this.host + "/memory/memory-wired", "value", "Wired");
|
224
|
+
} else if (os === "linux") {
|
225
|
+
this.graph.addSerie("" + this.host + "/memory/memory-buffered", "value", "Buffered");
|
226
|
+
this.graph.addSerie("" + this.host + "/memory/memory-cached", "value", "Caached");
|
227
|
+
this.graph.addSerie("" + this.host + "/memory/memory-free", "value", "Free");
|
228
|
+
this.graph.addSerie("" + this.host + "/memory/memory-used", "value", "Used");
|
229
|
+
}
|
230
|
+
}
|
231
|
+
return MemoryGraph;
|
232
|
+
})();
|
233
|
+
window.LoadGraph = (function() {
|
234
|
+
__extends(LoadGraph, GraphDefinition);
|
235
|
+
function LoadGraph(container, host, ymin) {
|
236
|
+
if (ymin == null) {
|
237
|
+
ymin = null;
|
238
|
+
}
|
239
|
+
LoadGraph.__super__.constructor.call(this, host, container, "CPU Load", [Format.identity, Format.identity], ymin);
|
240
|
+
this.graph.addSerie("" + this.host + "/load/load", "shortterm", "Load (1min)");
|
241
|
+
this.graph.addSerie("" + this.host + "/load/load", "midterm", "Load (5min)");
|
242
|
+
this.graph.addSerie("" + this.host + "/load/load", "longterm", "Load (15min)");
|
243
|
+
}
|
244
|
+
return LoadGraph;
|
245
|
+
})();
|
246
|
+
window.CollectdNetworkStats = (function() {
|
247
|
+
__extends(CollectdNetworkStats, GraphDefinition);
|
248
|
+
function CollectdNetworkStats(container, host, can_send, ymin) {
|
249
|
+
if (can_send == null) {
|
250
|
+
can_send = true;
|
251
|
+
}
|
252
|
+
if (ymin == null) {
|
253
|
+
ymin = null;
|
254
|
+
}
|
255
|
+
CollectdNetworkStats.__super__.constructor.call(this, host, container, "Network Stats (collectd)", [Format.identity, Format.identity], ymin);
|
256
|
+
this.graph.addSerie("" + this.host + "/network/queue_length", "value", "Queue length");
|
257
|
+
this.graph.addSerie("" + this.host + "/network/total_values-dispatch-accepted", "value", "Values dipatch accepted", 2);
|
258
|
+
this.graph.addSerie("" + this.host + "/network/total_values-dispatch-rejected", "value", "Values dipatch rejected", 2);
|
259
|
+
if (can_send) {
|
260
|
+
this.graph.addSerie("" + this.host + "/network/total_values-send-accepted", "value", "Values send accepted", 2);
|
261
|
+
this.graph.addSerie("" + this.host + "/network/total_values-send-rejected", "value", "Values send rejected", 2);
|
262
|
+
}
|
263
|
+
}
|
264
|
+
return CollectdNetworkStats;
|
265
|
+
})();
|
266
|
+
window.CollectdNetworkBandwidth = (function() {
|
267
|
+
__extends(CollectdNetworkBandwidth, GraphDefinition);
|
268
|
+
function CollectdNetworkBandwidth(container, host, can_send, ymin) {
|
269
|
+
if (can_send == null) {
|
270
|
+
can_send = true;
|
271
|
+
}
|
272
|
+
if (ymin == null) {
|
273
|
+
ymin = null;
|
274
|
+
}
|
275
|
+
CollectdNetworkBandwidth.__super__.constructor.call(this, host, container, "Network Usage (collectd)", [Format.size, Format.identity], ymin);
|
276
|
+
this.graph.addSerie("" + this.host + "/network/if_octets", "rx", "Bytes Received");
|
277
|
+
if (can_send) {
|
278
|
+
this.graph.addSerie("" + this.host + "/network/if_octets", "tx", "Bytes Sent");
|
279
|
+
}
|
280
|
+
this.graph.addSerie("" + this.host + "/network/if_packets", "rx", "Packets Received", 2);
|
281
|
+
if (can_send) {
|
282
|
+
this.graph.addSerie("" + this.host + "/network/if_packets", "tx", "Packets Sent", 2);
|
283
|
+
}
|
284
|
+
}
|
285
|
+
return CollectdNetworkBandwidth;
|
286
|
+
})();
|
287
|
+
window.MonitoringDriftGraph = (function() {
|
288
|
+
__extends(MonitoringDriftGraph, GraphDefinition);
|
289
|
+
function MonitoringDriftGraph(container, host, ymin) {
|
290
|
+
if (ymin == null) {
|
291
|
+
ymin = null;
|
292
|
+
}
|
293
|
+
MonitoringDriftGraph.__super__.constructor.call(this, host, container, "Clock drift", [Format.delay, Format.delay], ymin);
|
294
|
+
this.graph.addSerie("" + this.host + "/monitoring/gauge-clock_drift", "value", "Drift");
|
295
|
+
}
|
296
|
+
return MonitoringDriftGraph;
|
297
|
+
})();
|
298
|
+
}).call(this);
|
@@ -0,0 +1,32 @@
|
|
1
|
+
(function() {
|
2
|
+
var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
|
3
|
+
for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
|
4
|
+
function ctor() { this.constructor = child; }
|
5
|
+
ctor.prototype = parent.prototype;
|
6
|
+
child.prototype = new ctor;
|
7
|
+
child.__super__ = parent.prototype;
|
8
|
+
return child;
|
9
|
+
};
|
10
|
+
window.Serie = (function() {
|
11
|
+
__extends(Serie, StaticLine);
|
12
|
+
function Serie(rrd_path, ds_name, legend, yaxis, formatter, rra) {
|
13
|
+
this.rrd_path = rrd_path;
|
14
|
+
this.ds_name = ds_name;
|
15
|
+
this.legend = legend;
|
16
|
+
this.yaxis = yaxis != null ? yaxis : 1;
|
17
|
+
this.formatter = formatter != null ? formatter : Format.identity;
|
18
|
+
this.rra = rra != null ? rra : null;
|
19
|
+
Serie.__super__.constructor.call(this, null, legend, yaxis, formatter);
|
20
|
+
this.static = false;
|
21
|
+
}
|
22
|
+
Serie.prototype.get_definition = function() {
|
23
|
+
return {
|
24
|
+
data: this.data,
|
25
|
+
label: this.legend,
|
26
|
+
yaxis: this.yaxis,
|
27
|
+
color: this.color
|
28
|
+
};
|
29
|
+
};
|
30
|
+
return Serie;
|
31
|
+
})();
|
32
|
+
}).call(this);
|
@@ -0,0 +1,48 @@
|
|
1
|
+
(function() {
|
2
|
+
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
|
3
|
+
window.StaticLine = (function() {
|
4
|
+
function StaticLine(yvalue, legend, yaxis, formatter) {
|
5
|
+
this.yvalue = yvalue;
|
6
|
+
this.legend = legend;
|
7
|
+
this.yaxis = yaxis != null ? yaxis : 1;
|
8
|
+
this.formatter = formatter != null ? formatter : Format.identity;
|
9
|
+
this.enabled = true;
|
10
|
+
this.data = [];
|
11
|
+
this.static = true;
|
12
|
+
this.color = 'black';
|
13
|
+
}
|
14
|
+
StaticLine.prototype.set_data = function(data) {
|
15
|
+
this.data = [];
|
16
|
+
return $.each(data, __bind(function(t, v) {
|
17
|
+
return this.data.push([Time.server_to_client(t), v]);
|
18
|
+
}, this));
|
19
|
+
};
|
20
|
+
StaticLine.prototype.get_data = function() {
|
21
|
+
return this.data;
|
22
|
+
};
|
23
|
+
StaticLine.prototype.format = function(v) {
|
24
|
+
return this.formatter(v);
|
25
|
+
};
|
26
|
+
StaticLine.prototype.set_legend_color = function(element) {
|
27
|
+
var tr;
|
28
|
+
tr = $(element).parent();
|
29
|
+
return tr.toggleClass('transparent', !this.enabled);
|
30
|
+
};
|
31
|
+
StaticLine.prototype.set_enabled = function(new_state) {
|
32
|
+
return this.enabled = new_state;
|
33
|
+
};
|
34
|
+
StaticLine.prototype.toggle_enabled = function() {
|
35
|
+
return this.set_enabled(!this.enabled);
|
36
|
+
};
|
37
|
+
StaticLine.prototype.get_definition = function(from, to) {
|
38
|
+
this.data = [[Time.server_to_client(from), this.yvalue], [Time.server_to_client(to), this.yvalue]];
|
39
|
+
return {
|
40
|
+
data: this.data,
|
41
|
+
label: this.legend,
|
42
|
+
yaxis: this.yaxis,
|
43
|
+
color: this.color
|
44
|
+
};
|
45
|
+
};
|
46
|
+
return StaticLine;
|
47
|
+
})();
|
48
|
+
}).call(this);
|
@@ -0,0 +1,17 @@
|
|
1
|
+
(function() {
|
2
|
+
window.Time = {
|
3
|
+
tz_offset: 60 * -(new Date()).getTimezoneOffset(),
|
4
|
+
local_to_utc: function(timestamp) {
|
5
|
+
return parseInt(timestamp, 10) - Time.tz_offset;
|
6
|
+
},
|
7
|
+
utc_to_local: function(timestamp) {
|
8
|
+
return parseInt(timestamp, 10) + Time.tz_offset;
|
9
|
+
},
|
10
|
+
server_to_client: function(timestamp) {
|
11
|
+
return this.utc_to_local(timestamp) * 1000;
|
12
|
+
},
|
13
|
+
client_to_server: function(timestamp) {
|
14
|
+
return Math.floor(this.local_to_utc(timestamp / 1000));
|
15
|
+
}
|
16
|
+
};
|
17
|
+
}).call(this);
|
@@ -0,0 +1 @@
|
|
1
|
+
if(!document.createElement("canvas").getContext){(function(){var z=Math;var K=z.round;var J=z.sin;var U=z.cos;var b=z.abs;var k=z.sqrt;var D=10;var F=D/2;function T(){return this.context_||(this.context_=new W(this))}var O=Array.prototype.slice;function G(i,j,m){var Z=O.call(arguments,2);return function(){return i.apply(j,Z.concat(O.call(arguments)))}}function AD(Z){return String(Z).replace(/&/g,"&").replace(/"/g,""")}function r(i){if(!i.namespaces.g_vml_){i.namespaces.add("g_vml_","urn:schemas-microsoft-com:vml","#default#VML")}if(!i.namespaces.g_o_){i.namespaces.add("g_o_","urn:schemas-microsoft-com:office:office","#default#VML")}if(!i.styleSheets.ex_canvas_){var Z=i.createStyleSheet();Z.owningElement.id="ex_canvas_";Z.cssText="canvas{display:inline-block;overflow:hidden;text-align:left;width:300px;height:150px}"}}r(document);var E={init:function(Z){if(/MSIE/.test(navigator.userAgent)&&!window.opera){var i=Z||document;i.createElement("canvas");i.attachEvent("onreadystatechange",G(this.init_,this,i))}},init_:function(m){var j=m.getElementsByTagName("canvas");for(var Z=0;Z<j.length;Z++){this.initElement(j[Z])}},initElement:function(i){if(!i.getContext){i.getContext=T;r(i.ownerDocument);i.innerHTML="";i.attachEvent("onpropertychange",S);i.attachEvent("onresize",w);var Z=i.attributes;if(Z.width&&Z.width.specified){i.style.width=Z.width.nodeValue+"px"}else{i.width=i.clientWidth}if(Z.height&&Z.height.specified){i.style.height=Z.height.nodeValue+"px"}else{i.height=i.clientHeight}}return i}};function S(i){var Z=i.srcElement;switch(i.propertyName){case"width":Z.getContext().clearRect();Z.style.width=Z.attributes.width.nodeValue+"px";Z.firstChild.style.width=Z.clientWidth+"px";break;case"height":Z.getContext().clearRect();Z.style.height=Z.attributes.height.nodeValue+"px";Z.firstChild.style.height=Z.clientHeight+"px";break}}function w(i){var Z=i.srcElement;if(Z.firstChild){Z.firstChild.style.width=Z.clientWidth+"px";Z.firstChild.style.height=Z.clientHeight+"px"}}E.init();var I=[];for(var AC=0;AC<16;AC++){for(var AB=0;AB<16;AB++){I[AC*16+AB]=AC.toString(16)+AB.toString(16)}}function V(){return[[1,0,0],[0,1,0],[0,0,1]]}function d(m,j){var i=V();for(var Z=0;Z<3;Z++){for(var AF=0;AF<3;AF++){var p=0;for(var AE=0;AE<3;AE++){p+=m[Z][AE]*j[AE][AF]}i[Z][AF]=p}}return i}function Q(i,Z){Z.fillStyle=i.fillStyle;Z.lineCap=i.lineCap;Z.lineJoin=i.lineJoin;Z.lineWidth=i.lineWidth;Z.miterLimit=i.miterLimit;Z.shadowBlur=i.shadowBlur;Z.shadowColor=i.shadowColor;Z.shadowOffsetX=i.shadowOffsetX;Z.shadowOffsetY=i.shadowOffsetY;Z.strokeStyle=i.strokeStyle;Z.globalAlpha=i.globalAlpha;Z.font=i.font;Z.textAlign=i.textAlign;Z.textBaseline=i.textBaseline;Z.arcScaleX_=i.arcScaleX_;Z.arcScaleY_=i.arcScaleY_;Z.lineScale_=i.lineScale_}var B={aliceblue:"#F0F8FF",antiquewhite:"#FAEBD7",aquamarine:"#7FFFD4",azure:"#F0FFFF",beige:"#F5F5DC",bisque:"#FFE4C4",black:"#000000",blanchedalmond:"#FFEBCD",blueviolet:"#8A2BE2",brown:"#A52A2A",burlywood:"#DEB887",cadetblue:"#5F9EA0",chartreuse:"#7FFF00",chocolate:"#D2691E",coral:"#FF7F50",cornflowerblue:"#6495ED",cornsilk:"#FFF8DC",crimson:"#DC143C",cyan:"#00FFFF",darkblue:"#00008B",darkcyan:"#008B8B",darkgoldenrod:"#B8860B",darkgray:"#A9A9A9",darkgreen:"#006400",darkgrey:"#A9A9A9",darkkhaki:"#BDB76B",darkmagenta:"#8B008B",darkolivegreen:"#556B2F",darkorange:"#FF8C00",darkorchid:"#9932CC",darkred:"#8B0000",darksalmon:"#E9967A",darkseagreen:"#8FBC8F",darkslateblue:"#483D8B",darkslategray:"#2F4F4F",darkslategrey:"#2F4F4F",darkturquoise:"#00CED1",darkviolet:"#9400D3",deeppink:"#FF1493",deepskyblue:"#00BFFF",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1E90FF",firebrick:"#B22222",floralwhite:"#FFFAF0",forestgreen:"#228B22",gainsboro:"#DCDCDC",ghostwhite:"#F8F8FF",gold:"#FFD700",goldenrod:"#DAA520",grey:"#808080",greenyellow:"#ADFF2F",honeydew:"#F0FFF0",hotpink:"#FF69B4",indianred:"#CD5C5C",indigo:"#4B0082",ivory:"#FFFFF0",khaki:"#F0E68C",lavender:"#E6E6FA",lavenderblush:"#FFF0F5",lawngreen:"#7CFC00",lemonchiffon:"#FFFACD",lightblue:"#ADD8E6",lightcoral:"#F08080",lightcyan:"#E0FFFF",lightgoldenrodyellow:"#FAFAD2",lightgreen:"#90EE90",lightgrey:"#D3D3D3",lightpink:"#FFB6C1",lightsalmon:"#FFA07A",lightseagreen:"#20B2AA",lightskyblue:"#87CEFA",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#B0C4DE",lightyellow:"#FFFFE0",limegreen:"#32CD32",linen:"#FAF0E6",magenta:"#FF00FF",mediumaquamarine:"#66CDAA",mediumblue:"#0000CD",mediumorchid:"#BA55D3",mediumpurple:"#9370DB",mediumseagreen:"#3CB371",mediumslateblue:"#7B68EE",mediumspringgreen:"#00FA9A",mediumturquoise:"#48D1CC",mediumvioletred:"#C71585",midnightblue:"#191970",mintcream:"#F5FFFA",mistyrose:"#FFE4E1",moccasin:"#FFE4B5",navajowhite:"#FFDEAD",oldlace:"#FDF5E6",olivedrab:"#6B8E23",orange:"#FFA500",orangered:"#FF4500",orchid:"#DA70D6",palegoldenrod:"#EEE8AA",palegreen:"#98FB98",paleturquoise:"#AFEEEE",palevioletred:"#DB7093",papayawhip:"#FFEFD5",peachpuff:"#FFDAB9",peru:"#CD853F",pink:"#FFC0CB",plum:"#DDA0DD",powderblue:"#B0E0E6",rosybrown:"#BC8F8F",royalblue:"#4169E1",saddlebrown:"#8B4513",salmon:"#FA8072",sandybrown:"#F4A460",seagreen:"#2E8B57",seashell:"#FFF5EE",sienna:"#A0522D",skyblue:"#87CEEB",slateblue:"#6A5ACD",slategray:"#708090",slategrey:"#708090",snow:"#FFFAFA",springgreen:"#00FF7F",steelblue:"#4682B4",tan:"#D2B48C",thistle:"#D8BFD8",tomato:"#FF6347",turquoise:"#40E0D0",violet:"#EE82EE",wheat:"#F5DEB3",whitesmoke:"#F5F5F5",yellowgreen:"#9ACD32"};function g(i){var m=i.indexOf("(",3);var Z=i.indexOf(")",m+1);var j=i.substring(m+1,Z).split(",");if(j.length==4&&i.substr(3,1)=="a"){alpha=Number(j[3])}else{j[3]=1}return j}function C(Z){return parseFloat(Z)/100}function N(i,j,Z){return Math.min(Z,Math.max(j,i))}function c(AF){var j,i,Z;h=parseFloat(AF[0])/360%360;if(h<0){h++}s=N(C(AF[1]),0,1);l=N(C(AF[2]),0,1);if(s==0){j=i=Z=l}else{var m=l<0.5?l*(1+s):l+s-l*s;var AE=2*l-m;j=A(AE,m,h+1/3);i=A(AE,m,h);Z=A(AE,m,h-1/3)}return"#"+I[Math.floor(j*255)]+I[Math.floor(i*255)]+I[Math.floor(Z*255)]}function A(i,Z,j){if(j<0){j++}if(j>1){j--}if(6*j<1){return i+(Z-i)*6*j}else{if(2*j<1){return Z}else{if(3*j<2){return i+(Z-i)*(2/3-j)*6}else{return i}}}}function Y(Z){var AE,p=1;Z=String(Z);if(Z.charAt(0)=="#"){AE=Z}else{if(/^rgb/.test(Z)){var m=g(Z);var AE="#",AF;for(var j=0;j<3;j++){if(m[j].indexOf("%")!=-1){AF=Math.floor(C(m[j])*255)}else{AF=Number(m[j])}AE+=I[N(AF,0,255)]}p=m[3]}else{if(/^hsl/.test(Z)){var m=g(Z);AE=c(m);p=m[3]}else{AE=B[Z]||Z}}}return{color:AE,alpha:p}}var L={style:"normal",variant:"normal",weight:"normal",size:10,family:"sans-serif"};var f={};function X(Z){if(f[Z]){return f[Z]}var m=document.createElement("div");var j=m.style;try{j.font=Z}catch(i){}return f[Z]={style:j.fontStyle||L.style,variant:j.fontVariant||L.variant,weight:j.fontWeight||L.weight,size:j.fontSize||L.size,family:j.fontFamily||L.family}}function P(j,i){var Z={};for(var AF in j){Z[AF]=j[AF]}var AE=parseFloat(i.currentStyle.fontSize),m=parseFloat(j.size);if(typeof j.size=="number"){Z.size=j.size}else{if(j.size.indexOf("px")!=-1){Z.size=m}else{if(j.size.indexOf("em")!=-1){Z.size=AE*m}else{if(j.size.indexOf("%")!=-1){Z.size=(AE/100)*m}else{if(j.size.indexOf("pt")!=-1){Z.size=m/0.75}else{Z.size=AE}}}}}Z.size*=0.981;return Z}function AA(Z){return Z.style+" "+Z.variant+" "+Z.weight+" "+Z.size+"px "+Z.family}function t(Z){switch(Z){case"butt":return"flat";case"round":return"round";case"square":default:return"square"}}function W(i){this.m_=V();this.mStack_=[];this.aStack_=[];this.currentPath_=[];this.strokeStyle="#000";this.fillStyle="#000";this.lineWidth=1;this.lineJoin="miter";this.lineCap="butt";this.miterLimit=D*1;this.globalAlpha=1;this.font="10px sans-serif";this.textAlign="left";this.textBaseline="alphabetic";this.canvas=i;var Z=i.ownerDocument.createElement("div");Z.style.width=i.clientWidth+"px";Z.style.height=i.clientHeight+"px";Z.style.overflow="hidden";Z.style.position="absolute";i.appendChild(Z);this.element_=Z;this.arcScaleX_=1;this.arcScaleY_=1;this.lineScale_=1}var M=W.prototype;M.clearRect=function(){if(this.textMeasureEl_){this.textMeasureEl_.removeNode(true);this.textMeasureEl_=null}this.element_.innerHTML=""};M.beginPath=function(){this.currentPath_=[]};M.moveTo=function(i,Z){var j=this.getCoords_(i,Z);this.currentPath_.push({type:"moveTo",x:j.x,y:j.y});this.currentX_=j.x;this.currentY_=j.y};M.lineTo=function(i,Z){var j=this.getCoords_(i,Z);this.currentPath_.push({type:"lineTo",x:j.x,y:j.y});this.currentX_=j.x;this.currentY_=j.y};M.bezierCurveTo=function(j,i,AI,AH,AG,AE){var Z=this.getCoords_(AG,AE);var AF=this.getCoords_(j,i);var m=this.getCoords_(AI,AH);e(this,AF,m,Z)};function e(Z,m,j,i){Z.currentPath_.push({type:"bezierCurveTo",cp1x:m.x,cp1y:m.y,cp2x:j.x,cp2y:j.y,x:i.x,y:i.y});Z.currentX_=i.x;Z.currentY_=i.y}M.quadraticCurveTo=function(AG,j,i,Z){var AF=this.getCoords_(AG,j);var AE=this.getCoords_(i,Z);var AH={x:this.currentX_+2/3*(AF.x-this.currentX_),y:this.currentY_+2/3*(AF.y-this.currentY_)};var m={x:AH.x+(AE.x-this.currentX_)/3,y:AH.y+(AE.y-this.currentY_)/3};e(this,AH,m,AE)};M.arc=function(AJ,AH,AI,AE,i,j){AI*=D;var AN=j?"at":"wa";var AK=AJ+U(AE)*AI-F;var AM=AH+J(AE)*AI-F;var Z=AJ+U(i)*AI-F;var AL=AH+J(i)*AI-F;if(AK==Z&&!j){AK+=0.125}var m=this.getCoords_(AJ,AH);var AG=this.getCoords_(AK,AM);var AF=this.getCoords_(Z,AL);this.currentPath_.push({type:AN,x:m.x,y:m.y,radius:AI,xStart:AG.x,yStart:AG.y,xEnd:AF.x,yEnd:AF.y})};M.rect=function(j,i,Z,m){this.moveTo(j,i);this.lineTo(j+Z,i);this.lineTo(j+Z,i+m);this.lineTo(j,i+m);this.closePath()};M.strokeRect=function(j,i,Z,m){var p=this.currentPath_;this.beginPath();this.moveTo(j,i);this.lineTo(j+Z,i);this.lineTo(j+Z,i+m);this.lineTo(j,i+m);this.closePath();this.stroke();this.currentPath_=p};M.fillRect=function(j,i,Z,m){var p=this.currentPath_;this.beginPath();this.moveTo(j,i);this.lineTo(j+Z,i);this.lineTo(j+Z,i+m);this.lineTo(j,i+m);this.closePath();this.fill();this.currentPath_=p};M.createLinearGradient=function(i,m,Z,j){var p=new v("gradient");p.x0_=i;p.y0_=m;p.x1_=Z;p.y1_=j;return p};M.createRadialGradient=function(m,AE,j,i,p,Z){var AF=new v("gradientradial");AF.x0_=m;AF.y0_=AE;AF.r0_=j;AF.x1_=i;AF.y1_=p;AF.r1_=Z;return AF};M.drawImage=function(AO,j){var AH,AF,AJ,AV,AM,AK,AQ,AX;var AI=AO.runtimeStyle.width;var AN=AO.runtimeStyle.height;AO.runtimeStyle.width="auto";AO.runtimeStyle.height="auto";var AG=AO.width;var AT=AO.height;AO.runtimeStyle.width=AI;AO.runtimeStyle.height=AN;if(arguments.length==3){AH=arguments[1];AF=arguments[2];AM=AK=0;AQ=AJ=AG;AX=AV=AT}else{if(arguments.length==5){AH=arguments[1];AF=arguments[2];AJ=arguments[3];AV=arguments[4];AM=AK=0;AQ=AG;AX=AT}else{if(arguments.length==9){AM=arguments[1];AK=arguments[2];AQ=arguments[3];AX=arguments[4];AH=arguments[5];AF=arguments[6];AJ=arguments[7];AV=arguments[8]}else{throw Error("Invalid number of arguments")}}}var AW=this.getCoords_(AH,AF);var m=AQ/2;var i=AX/2;var AU=[];var Z=10;var AE=10;AU.push(" <g_vml_:group",' coordsize="',D*Z,",",D*AE,'"',' coordorigin="0,0"',' style="width:',Z,"px;height:",AE,"px;position:absolute;");if(this.m_[0][0]!=1||this.m_[0][1]||this.m_[1][1]!=1||this.m_[1][0]){var p=[];p.push("M11=",this.m_[0][0],",","M12=",this.m_[1][0],",","M21=",this.m_[0][1],",","M22=",this.m_[1][1],",","Dx=",K(AW.x/D),",","Dy=",K(AW.y/D),"");var AS=AW;var AR=this.getCoords_(AH+AJ,AF);var AP=this.getCoords_(AH,AF+AV);var AL=this.getCoords_(AH+AJ,AF+AV);AS.x=z.max(AS.x,AR.x,AP.x,AL.x);AS.y=z.max(AS.y,AR.y,AP.y,AL.y);AU.push("padding:0 ",K(AS.x/D),"px ",K(AS.y/D),"px 0;filter:progid:DXImageTransform.Microsoft.Matrix(",p.join(""),", sizingmethod='clip');")}else{AU.push("top:",K(AW.y/D),"px;left:",K(AW.x/D),"px;")}AU.push(' ">','<g_vml_:image src="',AO.src,'"',' style="width:',D*AJ,"px;"," height:",D*AV,'px"',' cropleft="',AM/AG,'"',' croptop="',AK/AT,'"',' cropright="',(AG-AM-AQ)/AG,'"',' cropbottom="',(AT-AK-AX)/AT,'"'," />","</g_vml_:group>");this.element_.insertAdjacentHTML("BeforeEnd",AU.join(""))};M.stroke=function(AM){var m=10;var AN=10;var AE=5000;var AG={x:null,y:null};var AL={x:null,y:null};for(var AH=0;AH<this.currentPath_.length;AH+=AE){var AK=[];var AF=false;AK.push("<g_vml_:shape",' filled="',!!AM,'"',' style="position:absolute;width:',m,"px;height:",AN,'px;"',' coordorigin="0,0"',' coordsize="',D*m,",",D*AN,'"',' stroked="',!AM,'"',' path="');var AO=false;for(var AI=AH;AI<Math.min(AH+AE,this.currentPath_.length);AI++){if(AI%AE==0&&AI>0){AK.push(" m ",K(this.currentPath_[AI-1].x),",",K(this.currentPath_[AI-1].y))}var Z=this.currentPath_[AI];var AJ;switch(Z.type){case"moveTo":AJ=Z;AK.push(" m ",K(Z.x),",",K(Z.y));break;case"lineTo":AK.push(" l ",K(Z.x),",",K(Z.y));break;case"close":AK.push(" x ");Z=null;break;case"bezierCurveTo":AK.push(" c ",K(Z.cp1x),",",K(Z.cp1y),",",K(Z.cp2x),",",K(Z.cp2y),",",K(Z.x),",",K(Z.y));break;case"at":case"wa":AK.push(" ",Z.type," ",K(Z.x-this.arcScaleX_*Z.radius),",",K(Z.y-this.arcScaleY_*Z.radius)," ",K(Z.x+this.arcScaleX_*Z.radius),",",K(Z.y+this.arcScaleY_*Z.radius)," ",K(Z.xStart),",",K(Z.yStart)," ",K(Z.xEnd),",",K(Z.yEnd));break}if(Z){if(AG.x==null||Z.x<AG.x){AG.x=Z.x}if(AL.x==null||Z.x>AL.x){AL.x=Z.x}if(AG.y==null||Z.y<AG.y){AG.y=Z.y}if(AL.y==null||Z.y>AL.y){AL.y=Z.y}}}AK.push(' ">');if(!AM){R(this,AK)}else{a(this,AK,AG,AL)}AK.push("</g_vml_:shape>");this.element_.insertAdjacentHTML("beforeEnd",AK.join(""))}};function R(j,AE){var i=Y(j.strokeStyle);var m=i.color;var p=i.alpha*j.globalAlpha;var Z=j.lineScale_*j.lineWidth;if(Z<1){p*=Z}AE.push("<g_vml_:stroke",' opacity="',p,'"',' joinstyle="',j.lineJoin,'"',' miterlimit="',j.miterLimit,'"',' endcap="',t(j.lineCap),'"',' weight="',Z,'px"',' color="',m,'" />')}function a(AO,AG,Ah,AP){var AH=AO.fillStyle;var AY=AO.arcScaleX_;var AX=AO.arcScaleY_;var Z=AP.x-Ah.x;var m=AP.y-Ah.y;if(AH instanceof v){var AL=0;var Ac={x:0,y:0};var AU=0;var AK=1;if(AH.type_=="gradient"){var AJ=AH.x0_/AY;var j=AH.y0_/AX;var AI=AH.x1_/AY;var Aj=AH.y1_/AX;var Ag=AO.getCoords_(AJ,j);var Af=AO.getCoords_(AI,Aj);var AE=Af.x-Ag.x;var p=Af.y-Ag.y;AL=Math.atan2(AE,p)*180/Math.PI;if(AL<0){AL+=360}if(AL<0.000001){AL=0}}else{var Ag=AO.getCoords_(AH.x0_,AH.y0_);Ac={x:(Ag.x-Ah.x)/Z,y:(Ag.y-Ah.y)/m};Z/=AY*D;m/=AX*D;var Aa=z.max(Z,m);AU=2*AH.r0_/Aa;AK=2*AH.r1_/Aa-AU}var AS=AH.colors_;AS.sort(function(Ak,i){return Ak.offset-i.offset});var AN=AS.length;var AR=AS[0].color;var AQ=AS[AN-1].color;var AW=AS[0].alpha*AO.globalAlpha;var AV=AS[AN-1].alpha*AO.globalAlpha;var Ab=[];for(var Ae=0;Ae<AN;Ae++){var AM=AS[Ae];Ab.push(AM.offset*AK+AU+" "+AM.color)}AG.push('<g_vml_:fill type="',AH.type_,'"',' method="none" focus="100%"',' color="',AR,'"',' color2="',AQ,'"',' colors="',Ab.join(","),'"',' opacity="',AV,'"',' g_o_:opacity2="',AW,'"',' angle="',AL,'"',' focusposition="',Ac.x,",",Ac.y,'" />')}else{if(AH instanceof u){if(Z&&m){var AF=-Ah.x;var AZ=-Ah.y;AG.push("<g_vml_:fill",' position="',AF/Z*AY*AY,",",AZ/m*AX*AX,'"',' type="tile"',' src="',AH.src_,'" />')}}else{var Ai=Y(AO.fillStyle);var AT=Ai.color;var Ad=Ai.alpha*AO.globalAlpha;AG.push('<g_vml_:fill color="',AT,'" opacity="',Ad,'" />')}}}M.fill=function(){this.stroke(true)};M.closePath=function(){this.currentPath_.push({type:"close"})};M.getCoords_=function(j,i){var Z=this.m_;return{x:D*(j*Z[0][0]+i*Z[1][0]+Z[2][0])-F,y:D*(j*Z[0][1]+i*Z[1][1]+Z[2][1])-F}};M.save=function(){var Z={};Q(this,Z);this.aStack_.push(Z);this.mStack_.push(this.m_);this.m_=d(V(),this.m_)};M.restore=function(){if(this.aStack_.length){Q(this.aStack_.pop(),this);this.m_=this.mStack_.pop()}};function H(Z){return isFinite(Z[0][0])&&isFinite(Z[0][1])&&isFinite(Z[1][0])&&isFinite(Z[1][1])&&isFinite(Z[2][0])&&isFinite(Z[2][1])}function y(i,Z,j){if(!H(Z)){return }i.m_=Z;if(j){var p=Z[0][0]*Z[1][1]-Z[0][1]*Z[1][0];i.lineScale_=k(b(p))}}M.translate=function(j,i){var Z=[[1,0,0],[0,1,0],[j,i,1]];y(this,d(Z,this.m_),false)};M.rotate=function(i){var m=U(i);var j=J(i);var Z=[[m,j,0],[-j,m,0],[0,0,1]];y(this,d(Z,this.m_),false)};M.scale=function(j,i){this.arcScaleX_*=j;this.arcScaleY_*=i;var Z=[[j,0,0],[0,i,0],[0,0,1]];y(this,d(Z,this.m_),true)};M.transform=function(p,m,AF,AE,i,Z){var j=[[p,m,0],[AF,AE,0],[i,Z,1]];y(this,d(j,this.m_),true)};M.setTransform=function(AE,p,AG,AF,j,i){var Z=[[AE,p,0],[AG,AF,0],[j,i,1]];y(this,Z,true)};M.drawText_=function(AK,AI,AH,AN,AG){var AM=this.m_,AQ=1000,i=0,AP=AQ,AF={x:0,y:0},AE=[];var Z=P(X(this.font),this.element_);var j=AA(Z);var AR=this.element_.currentStyle;var p=this.textAlign.toLowerCase();switch(p){case"left":case"center":case"right":break;case"end":p=AR.direction=="ltr"?"right":"left";break;case"start":p=AR.direction=="rtl"?"right":"left";break;default:p="left"}switch(this.textBaseline){case"hanging":case"top":AF.y=Z.size/1.75;break;case"middle":break;default:case null:case"alphabetic":case"ideographic":case"bottom":AF.y=-Z.size/2.25;break}switch(p){case"right":i=AQ;AP=0.05;break;case"center":i=AP=AQ/2;break}var AO=this.getCoords_(AI+AF.x,AH+AF.y);AE.push('<g_vml_:line from="',-i,' 0" to="',AP,' 0.05" ',' coordsize="100 100" coordorigin="0 0"',' filled="',!AG,'" stroked="',!!AG,'" style="position:absolute;width:1px;height:1px;">');if(AG){R(this,AE)}else{a(this,AE,{x:-i,y:0},{x:AP,y:Z.size})}var AL=AM[0][0].toFixed(3)+","+AM[1][0].toFixed(3)+","+AM[0][1].toFixed(3)+","+AM[1][1].toFixed(3)+",0,0";var AJ=K(AO.x/D)+","+K(AO.y/D);AE.push('<g_vml_:skew on="t" matrix="',AL,'" ',' offset="',AJ,'" origin="',i,' 0" />','<g_vml_:path textpathok="true" />','<g_vml_:textpath on="true" string="',AD(AK),'" style="v-text-align:',p,";font:",AD(j),'" /></g_vml_:line>');this.element_.insertAdjacentHTML("beforeEnd",AE.join(""))};M.fillText=function(j,Z,m,i){this.drawText_(j,Z,m,i,false)};M.strokeText=function(j,Z,m,i){this.drawText_(j,Z,m,i,true)};M.measureText=function(j){if(!this.textMeasureEl_){var Z='<span style="position:absolute;top:-20000px;left:0;padding:0;margin:0;border:none;white-space:pre;"></span>';this.element_.insertAdjacentHTML("beforeEnd",Z);this.textMeasureEl_=this.element_.lastChild}var i=this.element_.ownerDocument;this.textMeasureEl_.innerHTML="";this.textMeasureEl_.style.font=this.font;this.textMeasureEl_.appendChild(i.createTextNode(j));return{width:this.textMeasureEl_.offsetWidth}};M.clip=function(){};M.arcTo=function(){};M.createPattern=function(i,Z){return new u(i,Z)};function v(Z){this.type_=Z;this.x0_=0;this.y0_=0;this.r0_=0;this.x1_=0;this.y1_=0;this.r1_=0;this.colors_=[]}v.prototype.addColorStop=function(i,Z){Z=Y(Z);this.colors_.push({offset:i,color:Z.color,alpha:Z.alpha})};function u(i,Z){q(i);switch(Z){case"repeat":case null:case"":this.repetition_="repeat";break;case"repeat-x":case"repeat-y":case"no-repeat":this.repetition_=Z;break;default:n("SYNTAX_ERR")}this.src_=i.src;this.width_=i.width;this.height_=i.height}function n(Z){throw new o(Z)}function q(Z){if(!Z||Z.nodeType!=1||Z.tagName!="IMG"){n("TYPE_MISMATCH_ERR")}if(Z.readyState!="complete"){n("INVALID_STATE_ERR")}}function o(Z){this.code=this[Z];this.message=Z+": DOM Exception "+this.code}var x=o.prototype=new Error;x.INDEX_SIZE_ERR=1;x.DOMSTRING_SIZE_ERR=2;x.HIERARCHY_REQUEST_ERR=3;x.WRONG_DOCUMENT_ERR=4;x.INVALID_CHARACTER_ERR=5;x.NO_DATA_ALLOWED_ERR=6;x.NO_MODIFICATION_ALLOWED_ERR=7;x.NOT_FOUND_ERR=8;x.NOT_SUPPORTED_ERR=9;x.INUSE_ATTRIBUTE_ERR=10;x.INVALID_STATE_ERR=11;x.SYNTAX_ERR=12;x.INVALID_MODIFICATION_ERR=13;x.NAMESPACE_ERR=14;x.INVALID_ACCESS_ERR=15;x.VALIDATION_ERR=16;x.TYPE_MISMATCH_ERR=17;G_vmlCanvasManager=E;CanvasRenderingContext2D=W;CanvasGradient=v;CanvasPattern=u;DOMException=o})()};
|
@@ -0,0 +1 @@
|
|
1
|
+
(function(b){b.color={};b.color.make=function(f,e,c,d){var h={};h.r=f||0;h.g=e||0;h.b=c||0;h.a=d!=null?d:1;h.add=function(k,j){for(var g=0;g<k.length;++g){h[k.charAt(g)]+=j}return h.normalize()};h.scale=function(k,j){for(var g=0;g<k.length;++g){h[k.charAt(g)]*=j}return h.normalize()};h.toString=function(){if(h.a>=1){return"rgb("+[h.r,h.g,h.b].join(",")+")"}else{return"rgba("+[h.r,h.g,h.b,h.a].join(",")+")"}};h.normalize=function(){function g(j,k,i){return k<j?j:(k>i?i:k)}h.r=g(0,parseInt(h.r),255);h.g=g(0,parseInt(h.g),255);h.b=g(0,parseInt(h.b),255);h.a=g(0,h.a,1);return h};h.clone=function(){return b.color.make(h.r,h.b,h.g,h.a)};return h.normalize()};b.color.extract=function(e,d){var f;do{f=e.css(d).toLowerCase();if(f!=""&&f!="transparent"){break}e=e.parent()}while(!b.nodeName(e.get(0),"body"));if(f=="rgba(0, 0, 0, 0)"){f="transparent"}return b.color.parse(f)};b.color.parse=function(f){var e,c=b.color.make;if(e=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(f)){return c(parseInt(e[1],10),parseInt(e[2],10),parseInt(e[3],10))}if(e=/rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(f)){return c(parseInt(e[1],10),parseInt(e[2],10),parseInt(e[3],10),parseFloat(e[4]))}if(e=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(f)){return c(parseFloat(e[1])*2.55,parseFloat(e[2])*2.55,parseFloat(e[3])*2.55)}if(e=/rgba\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(f)){return c(parseFloat(e[1])*2.55,parseFloat(e[2])*2.55,parseFloat(e[3])*2.55,parseFloat(e[4]))}if(e=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(f)){return c(parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16))}if(e=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(f)){return c(parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16))}var d=b.trim(f).toLowerCase();if(d=="transparent"){return c(255,255,255,0)}else{e=a[d]||[0,0,0];return c(e[0],e[1],e[2])}};var a={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0]}})(jQuery);
|
@@ -0,0 +1 @@
|
|
1
|
+
(function(b){var a={crosshair:{mode:null,color:"rgba(170, 0, 0, 0.80)",lineWidth:1}};function c(h){var j={x:-1,y:-1,locked:false};h.setCrosshair=function e(l){if(!l){j.x=-1}else{var k=h.p2c(l);j.x=Math.max(0,Math.min(k.left,h.width()));j.y=Math.max(0,Math.min(k.top,h.height()))}h.triggerRedrawOverlay()};h.clearCrosshair=h.setCrosshair;h.lockCrosshair=function f(k){if(k){h.setCrosshair(k)}j.locked=true};h.unlockCrosshair=function g(){j.locked=false};function d(k){if(j.locked){return}if(j.x!=-1){j.x=-1;h.triggerRedrawOverlay()}}function i(k){if(j.locked){return}if(h.getSelection&&h.getSelection()){j.x=-1;return}var l=h.offset();j.x=Math.max(0,Math.min(k.pageX-l.left,h.width()));j.y=Math.max(0,Math.min(k.pageY-l.top,h.height()));h.triggerRedrawOverlay()}h.hooks.bindEvents.push(function(l,k){if(!l.getOptions().crosshair.mode){return}k.mouseout(d);k.mousemove(i)});h.hooks.drawOverlay.push(function(m,k){var n=m.getOptions().crosshair;if(!n.mode){return}var l=m.getPlotOffset();k.save();k.translate(l.left,l.top);if(j.x!=-1){k.strokeStyle=n.color;k.lineWidth=n.lineWidth;k.lineJoin="round";k.beginPath();if(n.mode.indexOf("x")!=-1){k.moveTo(j.x,0);k.lineTo(j.x,m.height())}if(n.mode.indexOf("y")!=-1){k.moveTo(0,j.y);k.lineTo(m.width(),j.y)}k.stroke()}k.restore()});h.hooks.shutdown.push(function(l,k){k.unbind("mouseout",d);k.unbind("mousemove",i)})}b.plot.plugins.push({init:c,options:a,name:"crosshair",version:"1.0"})})(jQuery);
|
@@ -0,0 +1 @@
|
|
1
|
+
(function(b){var a={series:{fillBetween:null}};function c(f){function d(j,h){var g;for(g=0;g<h.length;++g){if(h[g].id==j.fillBetween){return h[g]}}if(typeof j.fillBetween=="number"){g=j.fillBetween;if(g<0||g>=h.length){return null}return h[g]}return null}function e(B,u,g){if(u.fillBetween==null){return}var p=d(u,B.getData());if(!p){return}var y=g.pointsize,E=g.points,h=p.datapoints.pointsize,x=p.datapoints.points,r=[],w,v,k,G,F,q,t=u.lines.show,o=y>2&&g.format[2].y,n=t&&u.lines.steps,D=true,C=0,A=0,z;while(true){if(C>=E.length){break}z=r.length;if(E[C]==null){for(m=0;m<y;++m){r.push(E[C+m])}C+=y}else{if(A>=x.length){if(!t){for(m=0;m<y;++m){r.push(E[C+m])}}C+=y}else{if(x[A]==null){for(m=0;m<y;++m){r.push(null)}D=true;A+=h}else{w=E[C];v=E[C+1];G=x[A];F=x[A+1];q=0;if(w==G){for(m=0;m<y;++m){r.push(E[C+m])}q=F;C+=y;A+=h}else{if(w>G){if(t&&C>0&&E[C-y]!=null){k=v+(E[C-y+1]-v)*(G-w)/(E[C-y]-w);r.push(G);r.push(k);for(m=2;m<y;++m){r.push(E[C+m])}q=F}A+=h}else{if(D&&t){C+=y;continue}for(m=0;m<y;++m){r.push(E[C+m])}if(t&&A>0&&x[A-h]!=null){q=F+(x[A-h+1]-F)*(w-G)/(x[A-h]-G)}C+=y}}D=false;if(z!=r.length&&o){r[z+2]=q}}}}if(n&&z!=r.length&&z>0&&r[z]!=null&&r[z]!=r[z-y]&&r[z+1]!=r[z-y+1]){for(m=0;m<y;++m){r[z+y+m]=r[z+m]}r[z+1]=r[z-y+1]}}g.points=r}f.hooks.processDatapoints.push(e)}b.plot.plugins.push({init:c,options:a,name:"fillbetween",version:"1.0"})})(jQuery);
|
@@ -0,0 +1 @@
|
|
1
|
+
(function(c){var a={series:{images:{show:false,alpha:1,anchor:"corner"}}};c.plot.image={};c.plot.image.loadDataImages=function(g,f,k){var j=[],h=[];var i=f.series.images.show;c.each(g,function(l,m){if(!(i||m.images.show)){return}if(m.data){m=m.data}c.each(m,function(n,o){if(typeof o[0]=="string"){j.push(o[0]);h.push(o)}})});c.plot.image.load(j,function(l){c.each(h,function(n,o){var m=o[0];if(l[m]){o[0]=l[m]}});k()})};c.plot.image.load=function(h,i){var g=h.length,f={};if(g==0){i({})}c.each(h,function(k,j){var l=function(){--g;f[j]=this;if(g==0){i(f)}};c("<img />").load(l).error(l).attr("src",j)})};function d(q,o,l){var m=q.getPlotOffset();if(!l.images||!l.images.show){return}var r=l.datapoints.points,n=l.datapoints.pointsize;for(var t=0;t<r.length;t+=n){var y=r[t],w=r[t+1],g=r[t+2],v=r[t+3],f=r[t+4],h=l.xaxis,u=l.yaxis,x;if(!y||y.width<=0||y.height<=0){continue}if(w>v){x=v;v=w;w=x}if(g>f){x=f;f=g;g=x}if(l.images.anchor=="center"){x=0.5*(v-w)/(y.width-1);w-=x;v+=x;x=0.5*(f-g)/(y.height-1);g-=x;f+=x}if(w==v||g==f||w>=h.max||v<=h.min||g>=u.max||f<=u.min){continue}var k=0,s=0,j=y.width,p=y.height;if(w<h.min){k+=(j-k)*(h.min-w)/(v-w);w=h.min}if(v>h.max){j+=(j-k)*(h.max-v)/(v-w);v=h.max}if(g<u.min){p+=(s-p)*(u.min-g)/(f-g);g=u.min}if(f>u.max){s+=(s-p)*(u.max-f)/(f-g);f=u.max}w=h.p2c(w);v=h.p2c(v);g=u.p2c(g);f=u.p2c(f);if(w>v){x=v;v=w;w=x}if(g>f){x=f;f=g;g=x}x=o.globalAlpha;o.globalAlpha*=l.images.alpha;o.drawImage(y,k,s,j-k,p-s,w+m.left,g+m.top,v-w,f-g);o.globalAlpha=x}}function b(i,f,g,h){if(!f.images.show){return}h.format=[{required:true},{x:true,number:true,required:true},{y:true,number:true,required:true},{x:true,number:true,required:true},{y:true,number:true,required:true}]}function e(f){f.hooks.processRawData.push(b);f.hooks.drawSeries.push(d)}c.plot.plugins.push({init:e,options:a,name:"image",version:"1.1"})})(jQuery);
|