X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=testing%2FMCTXWeb%2Fpublic_html%2Fstatic%2Fmctx.graph.js;h=851fff2503ac0c9f8f4c6b55171d25d9fe5ad1e8;hb=710a022bd34d8d72bc588fca421ad25658fabd5b;hp=e79b6a88b703ba69d79e41ed52b4827d32c3d270;hpb=e0132025a1df98f88b2415e9e5f75ce7304efb33;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 e79b6a8..851fff2 100644 --- a/testing/MCTXWeb/public_html/static/mctx.graph.js +++ b/testing/MCTXWeb/public_html/static/mctx.graph.js @@ -11,6 +11,8 @@ mctx.graph.api.sensors = mctx.api + "sensors"; 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; @@ -23,6 +25,15 @@ mctx.graph.chart = null; * Appends each value pair to the result * @returns result */ +/** + * Helper - Calculate pairs of (dependent, independent) values + * Given input as (time, value) pairs for dependent and independent + * Appends each value pair to the result + * @param {array[][]} dependent Dependent data to be correlated with independent + * @param {array[][]} independent Independent data + * @param {array[][]} result Storage location + * @returns {dataMerge.result} + */ function dataMerge(dependent, independent, result) { var j = 0; for (var i = 0; i < dependent.length-1; ++i) { @@ -55,13 +66,17 @@ $.fn.deployDevices = function(input_type, check_first, group) { var container = this; var apply = function(dict, prefix) { $.each(dict, function(key, val) { + //Unique id (name mangling) + var id = container.attr('id') + "_" + prefix + "_" + val.name; + var attributes = { - 'type' : input_type, 'value' : key, 'alt' : val, + 'type' : input_type, 'value' : key, 'alt' : val.name, 'class' : prefix, 'name' : group, - 'id' : prefix + '_' + val //Unique id (name mangling) + 'id' : id }; + var entry = $("", attributes); - var label = $("