mctx.graph.api.actuators = mctx.api + "actuators";
mctx.sensors = {};
mctx.actuators = {};
+
+mctx.graph.devices = {};
mctx.graph.dependent = null;
mctx.graph.independent = null;
mctx.graph.timer = null;
'class' : prefix, 'name' : group,
'id' : prefix + '_' + val //Unique id (name mangling)
};
+
var entry = $("<input/>", attributes);
var label = $("<label/>", {'for' : prefix + '_' + val, 'text' : val});
entry.prop("checked", check_first);
var plot_data = [];
yaxis.each(function() {
+ var series = {};
+ series.label = $(this).attr("alt");
+
//alert("Add " + $(this).val() + " to plot");
if (xaxis.attr("alt") === "time") {
//alert("Against time");
- plot_data.push(devices[$(this).attr("alt")].data);
+ series.data = devices[$(this).attr("alt")].data;
} else {
var result = []
dataMerge(devices[xaxis.attr("alt")].data,
devices[$(this).attr("alt")].data, result);
- plot_data.push(result);
+ series.data = result;
}
+ plot_data.push(series);
});
if (mctx.graph.chart !== null) {
mctx.graph.chart.setupGrid();
mctx.graph.chart.draw();
} else {
- mctx.graph.chart = $.plot("#graph", plot_data);
+ var options = {
+ legend : {
+ container : "#graph-legend"
+ }
+ };
+ mctx.graph.chart = $.plot("#graph", plot_data, options);
}
mctx.graph.timer = setTimeout(updater, 1000);
}