From da84cb86608bc685eb71443ad82287b4f409092b Mon Sep 17 00:00:00 2001 From: chrono Date: Sun, 1 Dec 2013 02:05:24 +0100 Subject: [PATCH] New profile feature implemented --- public/assets/js/picoreflow.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/public/assets/js/picoreflow.js b/public/assets/js/picoreflow.js index 9d8c3e5..4c3cd05 100644 --- a/public/assets/js/picoreflow.js +++ b/public/assets/js/picoreflow.js @@ -67,11 +67,11 @@ function updateProfileTable() { var html = ""; - for(var i=0; i'; - html += '
'; + html += ''; + html += '
'; } $('#profile_table').html(html); @@ -110,6 +110,7 @@ function enterNewMode() $('#form_profile_name').attr('placeholder', 'Please enter a name'); graph.profile.points.show = true; graph.profile.draggable = true; + graph.profile.data = []; graph.plot = $.plot("#graph_container", [ graph.profile, graph.live ], getOptions()); updateProfileTable(); } @@ -143,7 +144,15 @@ function leaveEditMode() function newPoint() { - graph.profile.data.push([parseInt(graph.profile.data[graph.profile.data.length-1][0])+15, Math.floor((Math.random()*230)+25)]); + if(graph.profile.data.length > 0) + { + var pointx = parseInt(graph.profile.data[graph.profile.data.length-1][0])+15; + } + else + { + var pointx = 0; + } + graph.profile.data.push([pointx, Math.floor((Math.random()*230)+25)]); graph.plot = $.plot("#graph_container", [ graph.profile, graph.live ], getOptions()); updateProfileTable(); }