+ return this;
+}
+
+/**
+ * Sets the graphs to graph stuff.
+ * @returns {$.fn}
+ */
+$.fn.setGraph = function () {
+ // Determine which actuator/sensors to plot
+ var xaxis = $("#xaxis input[name=xaxis]:checked");
+ var yaxis = $("#yaxis input[name=yaxis]:checked");
+ if (xaxis.size() < 1 || yaxis.size() < 1) {
+ //nothing to plot...
+ setGraphStatus(false, "No x or y axis selected.");
+ return;
+ }
+
+ var start_time = $("#start_time").val();
+ var end_time = $("#end_time").val();
+ if (!$.isNumeric(start_time)) {
+ start_time = null;
+ }
+ if (!$.isNumeric(end_time)) {
+ end_time = null;
+ }
+
+ var devices = {};
+ var populateDict = function () {
+ var dict = {};
+ dict['urltype'] = $(this).attr("class");
+ dict['id'] = $(this).attr("value");
+ dict['data'] = [];
+ dict['start_time'] = start_time;
+ dict['end_time'] = end_time;
+ devices[$(this).attr("alt")] = dict;
+ };
+ xaxis.each(populateDict);
+ yaxis.each(populateDict);
+
+ mctx.graph.xaxis = xaxis;
+ mctx.graph.yaxis = yaxis;
+ mctx.graph.start_time = start_time;
+ mctx.graph.end_time = end_time;
+ mctx.graph.devices = devices;
+
+ if (!mctx.graph.running) {
+ $("#graph-run").val("Pause");
+ $("#status-text").text("")
+ graphUpdater();
+ }
+