Addition of slope line to graph 77/40177/4
authorsaksham115 <saksham.agrawal@research.iiit.ac.in>
Thu, 24 Aug 2017 21:46:58 +0000 (03:16 +0530)
committerMark Beierl <mark.beierl@dell.com>
Fri, 25 Aug 2017 14:45:42 +0000 (14:45 +0000)
JIRA: STORPERF-195

Change-Id: I0d674c77976ba7378143edcef4485a6b90a19fc7
Signed-off-by: saksham115 <saksham.agrawal@research.iiit.ac.in>
docker/storperf-reporting/src/templates/plot_tables.html

index 344f08b..a0770bf 100644 (file)
                 name: '90%*Average',
                 type: 'scatter'
             };
-            var plot_data = [trace1,trace2,trace3,trace4];
+            // Creating slope plot in var trace5
+            var slope_y = [];
+            var slope_mid = parseInt(len/2);
+            // Init slope_y with average
+            for(var i = 0; i < len; i++){
+                slope_y.push(average);
+            }
+            // Creating the slope plot
+            var i = slope_mid - 1;
+            var count = data["slope"];
+            while(i >= 0){
+                slope_y[i] -= count;
+                count += data["slope"];
+                i--;
+            }
+            var i = slope_mid + 1;
+            var count = data["slope"];
+            while(i < len){
+                slope_y[i] += count;
+                count += data["slope"];
+                i++;
+            }
+            var trace5 = {
+                x: x,
+                y: slope_y,
+                name: 'Slope',
+                type: 'scatter'
+            };
+            var plot_data = [trace1,trace2,trace3,trace4,trace5];
             Plotly.newPlot('graph',plot_data,layout);
             modal.style.display = "block";
             table = "<table class='table table-bordered'>";
             table += "<tr><td> Allowed Maximum Data Excursion: " + 0.2*average +
                      "</td><td> Measured Maximum Data Excursion: " + data["range"] + "</td></tr>";
             table += "<tr><td> Allowed Maximum Slope Excursion: " + 0.1*average +
-                     "</td><td> Measured Maximum Data Excursion: " + data["slope"] + "</td></tr>";
+                     "</td><td> Measured Maximum Slope Excursion: " + data["slope"] + "</td></tr>";
             table += "</tbody></table>";
             document.getElementById("report").innerHTML = table;