From 4075cab5d9dbf3816183ab8378cdc021eee22d14 Mon Sep 17 00:00:00 2001 From: Sebastian Steuer Date: Sat, 7 Dec 2013 17:41:34 +0100 Subject: [PATCH] changing the profile table updates the graph --- public/assets/js/picoreflow.js | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/public/assets/js/picoreflow.js b/public/assets/js/picoreflow.js index 48bb342..20226cb 100644 --- a/public/assets/js/picoreflow.js +++ b/public/assets/js/picoreflow.js @@ -81,8 +81,8 @@ function updateProfileTable() if (dps == 0) { slope = "right"; color[0]="white"; color[1]="grey"; } html += '

' + i + '

'; - html += ''; - html += ''; + html += ''; + html += ''; html += '
'; html += ' '; @@ -91,6 +91,20 @@ function updateProfileTable() html += ''; $('#profile_table').html(html); + + //Link table to graph + $(".form-control").change(function(e) + { + var id = $(this)[0].id//e.currentTarget.attributes.id; + var value = parseInt($(this)[0].value); + var fields = id.split("-"); + var col = parseInt(fields[1]); + var row = parseInt(fields[2]); + + graph.profile.data[row][col] = value; + graph.plot = $.plot("#graph_container", [ graph.profile, graph.live ], getOptions()); + updateProfileTable(); + }); } function runTask() @@ -538,5 +552,6 @@ $(document).ready(function() { update_profile(e.val); }); + } });