[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kde-workspace/plasma/sreich/qml2-system-monitors] plasma/generic/applets/system-monitor/plotter/pri
From:       Shaun Reich <shaun.reich () kdemail ! net>
Date:       2012-02-17 2:06:23
Message-ID: 20120217020623.23104A60A6 () git ! kde ! org
[Download RAW message or body]

Git commit b90c52f39ba7f1f80709c4f73bccacc3b770dd6c by Shaun Reich.
Committed on 17/02/2012 at 00:33.
Pushed by sreich into branch 'plasma/sreich/qml2-system-monitors'.

should be assigning the values to the right indexes now

i believe there's just an issue with drawing the 2nd sampleset proerply

M  +27   -15   plasma/generic/applets/system-monitor/plotter/private/plotterpainter.js


http://commits.kde.org/kde-workspace/b90c52f39ba7f1f80709c4f73bccacc3b770dd6c

diff --git a/plasma/generic/applets/system-monitor/plotter/private/plotterpainter.js \
b/plasma/generic/applets/system-monitor/plotter/private/plotterpainter.js index \
                a820c9c..3037e55 100644
--- a/plasma/generic/applets/system-monitor/plotter/private/plotterpainter.js
+++ b/plasma/generic/applets/system-monitor/plotter/private/plotterpainter.js
@@ -67,10 +67,12 @@ var hoverText = {visible: false, x: 0, y: 0, clearNeeded: false}
  */
 function addSample(y, sampleSet, fillColor)
 {
-    if (points.length - 1 < sampleSet) {
+    var pointsIndex = sampleSet;
+
+    if (points[pointsIndex] === undefined) {
         points.push(new Array());
         print("PUSHED NEW ARRAY TO POINTS");
-        points[points.length - 1].push(new Array());
+        points[pointsIndex].push(new Array());
 //        points[points.length - 1][points
     }
 
@@ -79,11 +81,8 @@ function addSample(y, sampleSet, fillColor)
     // set x at a predefined interval (horizSpace)
     // only takes into consideration current length of sampleSet
     // because that's all that matters (each set is compartmentalized)
-    var pointsIndex = points.length - 1;
 
     var xValue = graphPadding + (horizSpace * (points[pointsIndex].length));
-    print("POINTS[INDEX][0] " + points[pointsIndex].length)
-print("X VALUE: " + xValue);
 
 //    print("X VALUE: " + points[points.length - 1][points[points.length - 1].length \
- 1].x);  var yValue = y;
@@ -92,10 +91,17 @@ print("X VALUE: " + xValue);
 
 //        print("LENGTH: " + points.length + " SUB LENGTH: " + sampleSetLength);
 
-        print("NEWLENGTH: " + points.length);
+//        print("NEWLENGTH: " + points.length);
+
+    print("$$$$$$POINTS INDEX IS: " + pointsIndex);
+        points[pointsIndex].push( { x: xValue, originalY: yValue, scaledY: yValue, \
fillColor: fillColor } ); +
+    print("POINTS[INDEX].length " + points[pointsIndex].length);
+//print("POINTS[INDEX][0]: " + points[pointsIndex][0]);
+//print("POINTS[INDEX][1]: " + points[pointsIndex][1]);
+print("POINTS[INDEX][sampleSet]: " + points[pointsIndex][sampleSet]);
 
-        points[points.length - 1].push( { x: xValue, originalY: yValue, scaledY: \
                yValue, fillColor: fillColor } );
-debug("SAMPLE POINT ADDED:" + points[points.length - 1][points[points.length - \
1].length - 1].x ); +//debug("SAMPLE POINT ADDED:" + points[points.length - \
1][points[points.length - 1].length - 1].x );  //        print("SAMPLE LISTS \
POINTS:length: " + sampleSetLength +  " " + points[points.length - 1][sampleSetLength \
- 1].x);  
  //   downscaleOne(y);
@@ -106,8 +112,8 @@ debug("SAMPLE POINT ADDED:" + points[points.length - \
1][points[points.length - 1  //        upscale(y);
     }
 
-    debug("sample list: " + points);
-    debug("requesting new paint event");
+//    debug("sample list: " + points);
+   // debug("requesting new paint event");
 }
 
 /**
@@ -192,7 +198,6 @@ function init(width, height)
     }
 
 
-    debug("POOOINTS LENGTH: " + points.length);
     debug("width: " + this.width);
 
     // TODO: find a scalar, mostly for vertSpace
@@ -208,14 +213,16 @@ function advancePlotter()
 {
     debug("");
     var yPercent = Math.floor(Math.random() * 100);
+    var yPercent2 = Math.floor(Math.random() * 100);
     debug("randomly generated number: " + yPercent);
     debug("$$$$$$$ vertSspace: " + vertSpace);
     debug("$$$$$$$ yPercent: " + yPercent);
     debug("$$$$$$$ graphPadding: " + graphPadding);
     var yPos = (height * (yPercent / 100) + graphPadding * 2);
+    var yPos2 = (height * (yPercent / 100) + graphPadding * 2);
     debug("randomly generated y pos: " + yPos);
     addSample(height - yPos, 0, "rgba(0, 0, 255, 1)");
-    addSample(Math.floor(Math.random() * 100), 1, "rgba(0, 0, 0, .5)");
+    addSample(height - yPos2, 1, "rgba(0, 0, 0, .5)");
 
 //    if ((points[points.length - 1][sampleSetLength - 1] * horizSpace) >= width - \
graphPadding) {  //        shiftLeft();
@@ -310,14 +317,19 @@ function drawBarGraph()
         for(var j = 0; j < points[i].length; ++j) {
             var x;
             var y;
-            print("$$$$$$$$$$$$ DRAWING BARS AT X: " + x)
-            print("$$$$$$$$$$$$ DRAWING BARS AT Y: " + y)
+ //           print("$$$$$$$$$$$$ DRAWING BARS AT X: " + x)
+ //           print("$$$$$$$$$$$$ DRAWING BARS AT Y: " + y)
 
             x = points[i][j].x;
             y = points[i][j].scaledY;
 
             context.fillStyle = points[i][j].fillColor;
-print("%%%%%%%%% FILL COLOR: " + points[i][j].fillColor);
+//            print("^^^^ value of i: " + i + " &^^&& VALUE OF J:"  + j);
+//            
+//            print("^^^^ value of points.length: " + points.length + " &^^&& VALUE \
OF points[i].length:"  + points[i].length); +//print("%%%%%%%%% drawbargraph, x: " + \
points[i][j].x); +//print("%%%%%%%%% drawbargraph, y: " + points[i][j].scaledY);
+//print("%%%%%%%%% FILL COLOR: " + points[i][j].fillColor);
             context.rect(x, y, horizSpace, (height - graphPadding) - y);
         }
         


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic