changing the profile table updates the graph

This commit is contained in:
Sebastian Steuer 2013-12-07 17:41:34 +01:00
parent 87a6690c33
commit 4075cab5d9

View File

@ -81,8 +81,8 @@ function updateProfileTable()
if (dps == 0) { slope = "right"; color[0]="white"; color[1]="grey"; }
html += '<tr><td><h4>' + i + '</h4></td>';
html += '<td><input type="text" class="form-control" value="'+ graph.profile.data[i][0] + '" style="width: 60px" /></td>';
html += '<td><input type="text" class="form-control" value="'+ graph.profile.data[i][1] + '" style="width: 60px" /></td>';
html += '<td><input type="text" class="form-control" id="profiletable-0-'+i+'" value="'+ graph.profile.data[i][0] + '" style="width: 60px" /></td>';
html += '<td><input type="text" class="form-control" id="profiletable-1-'+i+'" value="'+ graph.profile.data[i][1] + '" style="width: 60px" /></td>';
html += '<td><div class="input-group"><span class="glyphicon glyphicon-arrow-' + slope +
' input-group-addon" style="top: 0; text-shadow: 1px 1px 0 rgba(255, 255, 255, 1), -1px -1px 0 rgba(0, 0, 0, 1); font-weight: bold; color: '+color[0]+'; background: '+color[1]+'"></span><input type="text" class="form-control ds-input" value="' + dps + '" style="width: 50px" /></div></td>';
html += '<td>&nbsp;</td></tr>';
@ -91,6 +91,20 @@ function updateProfileTable()
html += '</table></div>';
$('#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);
});
}
});