X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=testing%2FMCTXWeb%2Fpublic_html%2Fstatic%2Fmctx.graph.js;h=b91eab381a9ed66b0fe5b6c1686da8ac60b89620;hb=436f212a07c30061ccca52ff0c107ccf99921d83;hp=687db8413744dc05699a3b4d8d2f5c4de28c223b;hpb=efd9baef20d693f70259634c565cffb3da7cc940;p=matches%2FMCTX3420.git diff --git a/testing/MCTXWeb/public_html/static/mctx.graph.js b/testing/MCTXWeb/public_html/static/mctx.graph.js index 687db84..b91eab3 100644 --- a/testing/MCTXWeb/public_html/static/mctx.graph.js +++ b/testing/MCTXWeb/public_html/static/mctx.graph.js @@ -15,6 +15,7 @@ mctx.graph.dependent = null; mctx.graph.independent = null; mctx.graph.timer = null; mctx.graph.running = false; +mctx.graph.chart = null; /** * Helper - Calculate pairs of (dependent, independent) values @@ -89,7 +90,7 @@ $.fn.setDevices = function() { $("#xaxis").deployDevices("radio", false, 'xaxis'); $("#yaxis").deployDevices("checkbox", true, 'yaxis'); $("#current_time").val(data.running_time); - //Add event listeners for when the inputs are changed + //Add event listeners for when the $(".change input").change(function () { $("#graph").setGraph(); }); @@ -164,7 +165,14 @@ function graphUpdater() { } }); - $.plot("#graph", plot_data); + //$.plot("#graph", plot_data); + if (mctx.graph.chart !== null) { + mctx.graph.chart.setData(plot_data); + mctx.graph.chart.setupGrid(); + mctx.graph.chart.draw(); + } else { + mctx.graph.chart = $.plot("#graph", plot_data); + } if (mctx.graph.running) { mctx.graph.timer = setTimeout(updater, 1000); }