Author: pmouawad
Date: Sat Sep 24 08:11:19 2016
New Revision: 1762107

URL: http://svn.apache.org/viewvc?rev=1762107&view=rev
Log:
Bug 60171 - Report / Dashboard : Active Threads Over Time should stack lines to 
give the total amount of threads running
Bugzilla Id: 60171

Added:
    jmeter/trunk/bin/report-template/content/js/jquery.flot.stack.js   (with 
props)
Modified:
    jmeter/trunk/bin/report-template/content/js/graph.js.fmkr
    jmeter/trunk/bin/report-template/content/pages/OverTime.html.fmkr
    jmeter/trunk/xdocs/changes.xml

Modified: jmeter/trunk/bin/report-template/content/js/graph.js.fmkr
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/bin/report-template/content/js/graph.js.fmkr?rev=1762107&r1=1762106&r2=1762107&view=diff
==============================================================================
--- jmeter/trunk/bin/report-template/content/js/graph.js.fmkr (original)
+++ jmeter/trunk/bin/report-template/content/js/graph.js.fmkr Sat Sep 24 
08:11:19 2016
@@ -431,8 +431,10 @@ var activeThreadsOverTimeInfos = {
         getOptions: function() {
             return {
                 series: {
+                    stack: true,
                     lines: {
-                        show: true
+                        show: true,
+                        fill: true
                     },
                     points: {
                         show: true

Added: jmeter/trunk/bin/report-template/content/js/jquery.flot.stack.js
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/bin/report-template/content/js/jquery.flot.stack.js?rev=1762107&view=auto
==============================================================================
--- jmeter/trunk/bin/report-template/content/js/jquery.flot.stack.js (added)
+++ jmeter/trunk/bin/report-template/content/js/jquery.flot.stack.js Sat Sep 24 
08:11:19 2016
@@ -0,0 +1,83 @@
+/* Flot plugin for stacking data sets rather than overlyaing them.
+
+Copyright (c) 2007-2014 IOLA and Ole Laursen.
+Licensed under the MIT license.
+
+The plugin assumes the data is sorted on x (or y if stacking horizontally).
+For line charts, it is assumed that if a line has an undefined gap (from a
+null point), then the line above it should have the same gap - insert zeros
+instead of "null" if you want another behaviour. This also holds for the start
+and end of the chart. Note that stacking a mix of positive and negative values
+in most instances doesn't make sense (so it looks weird).
+
+Two or more series are stacked when their "stack" attribute is set to the same
+key (which can be any number or string or just "true"). To specify the default
+stack, you can set the stack option like this:
+
+       series: {
+               stack: null/false, true, or a key (number/string)
+       }
+
+You can also specify it for a single series, like this:
+
+       $.plot( $("#placeholder"), [{
+               data: [ ... ],
+               stack: true
+       }])
+
+The stacking order is determined by the order of the data series in the array
+(later series end up on top of the previous).
+
+Internally, the plugin modifies the datapoints in each series, adding an
+offset to the y value. For line series, extra data points are inserted through
+interpolation. If there's a second y value, it's also adjusted (e.g for bar
+charts or filled areas).
+
+*/
+
+/**
+ * Patched version as per https://github.com/flot/flot/issues/326
+ */
+(function ($) {
+       var options = {
+               series: { stack: null } // or number/string
+       };
+
+       function init(plot) {
+
+       // will be built up dynamically as a hash from x-value to
+           var stackBases = {};
+
+       function stackData(plot, s, datapoints) {
+               if (s.stack == null || s.stack === false)
+               return;
+
+               var newPoints = [];
+       
+           for (var i=0; i <  datapoints.points.length; i += 3) {
+
+                   if (!stackBases[datapoints.points[i]]) {
+                   stackBases[datapoints.points[i]] = 0;
+                   }
+
+               // note that the values need to be turned into absolute 
y-values.
+                   // in other words, if you were to stack (x, y1), (x, y2), 
and (x, y3), (each from different series, which is where stackBases comes in),
+                               // you'd want the new points to be (x, y1, 0), 
(x, y1+y2, y1), (x,y1+y2+y3, y1+y2)
+                               // generally, (x, thisValue + (base up to this 
point), + (base up tothis point))
+                   newPoints[i] = datapoints.points[i];
+                   newPoints[i+1] = datapoints.points[i+1] + 
stackBases[datapoints.points[i]];
+                               newPoints[i+2] = 
stackBases[datapoints.points[i]];
+                   stackBases[datapoints.points[i]] += datapoints.points[i+1];
+               }
+               datapoints.points = newPoints;
+       }
+       plot.hooks.processDatapoints.push(stackData);
+       }
+
+       $.plot.plugins.push({
+           init: init,
+       options: options,
+           name: 'stack',
+       version: '1.2-patch-326'
+       });
+})(jQuery);
\ No newline at end of file

Propchange: jmeter/trunk/bin/report-template/content/js/jquery.flot.stack.js
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: jmeter/trunk/bin/report-template/content/pages/OverTime.html.fmkr
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/bin/report-template/content/pages/OverTime.html.fmkr?rev=1762107&r1=1762106&r2=1762107&view=diff
==============================================================================
--- jmeter/trunk/bin/report-template/content/pages/OverTime.html.fmkr (original)
+++ jmeter/trunk/bin/report-template/content/pages/OverTime.html.fmkr Sat Sep 
24 08:11:19 2016
@@ -494,6 +494,7 @@
     <script 
src="../../sbadmin2-1.0.7/bower_components/flot/jquery.flot.time.js"></script>
     <script 
src="../../sbadmin2-1.0.7/bower_components/flot/jquery.flot.selection.js"></script>
     <script 
src="../../sbadmin2-1.0.7/bower_components/flot.tooltip/js/jquery.flot.tooltip.min.js"></script>
+    <script src="../js/jquery.flot.stack.js"></script>
     <script src="../js/jquery.flot.axislabels.js"></script>
     <script src="../js/hashtable.js"></script>
     <script src="../js/jquery.numberformatter-1.2.3.min.js"></script>

Modified: jmeter/trunk/xdocs/changes.xml
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1762107&r1=1762106&r2=1762107&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
+++ jmeter/trunk/xdocs/changes.xml [utf-8] Sat Sep 24 08:11:19 2016
@@ -149,6 +149,7 @@ Summary
     <li><bug>60108</bug>Report / Dashboard : In Requests Summary rounding is 
too aggressive</li>
     <li><bug>60098</bug>Report / Dashboard : Reduce default value for 
"jmeter.reportgenerator.statistic_window" to reduce memory impact</li>
     <li><bug>60115</bug>Add date format property for start/end date filter 
into Report generator</li>
+    <li><bug>60171</bug>Report / Dashboard : Active Threads Over Time should 
stack lines to give the total amount of threads running</li>
 </ul>
 <h3>General</h3>
 <ul>


Reply via email to