- var plot_data = [];
- yaxis.each(function() {
- //alert("Add " + $(this).val() + " to plot");
- if (xaxis.attr("alt") === "time") {
- //alert("Against time");
- plot_data.push(devices[$(this).attr("alt")].data);
+ if (mctx.graph.running) {
+ var plot_data = [];
+
+ yaxis.each(function() {
+ //alert("Add " + $(this).val() + " to plot");
+ if (xaxis.attr("alt") === "time") {
+ //alert("Against time");
+ plot_data.push(devices[$(this).attr("alt")].data);
+ } else {
+ var result = []
+ dataMerge(devices[xaxis.attr("alt")].data,
+ devices[$(this).attr("alt")].data, result);
+ plot_data.push(result);
+ }
+ });
+
+ if (mctx.graph.chart !== null) {
+ mctx.graph.chart.setData(plot_data);
+ mctx.graph.chart.setupGrid();
+ mctx.graph.chart.draw();