[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-16 19:52:57
Message-ID: 20120216195257.B1C98A60A6 () git ! kde ! org
[Download RAW message or body]

Git commit db238a9c37e381642803b49fd44e6c1e13563609 by Shaun Reich.
Committed on 16/02/2012 at 20:52.
Pushed by sreich into branch 'plasma/sreich/qml2-system-monitors'.

fix most of it. for some reason it keeps drawing rects at the same pos

though. shouldn't be too hard to fix

M  +12   -9    plasma/generic/applets/system-monitor/plotter/private/plotterpainter.js


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

diff --git a/plasma/generic/applets/system-monitor/plotter/private/plotterpainter.js \
b/plasma/generic/applets/system-monitor/plotter/private/plotterpainter.js index \
                942863d..8e973f9 100644
--- a/plasma/generic/applets/system-monitor/plotter/private/plotterpainter.js
+++ b/plasma/generic/applets/system-monitor/plotter/private/plotterpainter.js
@@ -34,7 +34,6 @@ var vertSpace;
 */
 var points = Array();
 // just a convenience instead of doing points[points.length - 1][.. etc.
-//for some reason do points[0][sampleSetLength], not - 1
 var sampleSetLength = 0;
 
 var canvas;
@@ -73,16 +72,20 @@ function addSample(y, sampleSet)
 
     var yValue = y;
 
-    if (sampleSet > points.length - 1) {
+    if (points.length - 1 < sampleSet) {
         points.push(new Array());
+        print("PUSHED NEW ARRAY TO POINTS");
+    }
 
-        sampleSetLength += 1;
      //  print(points[points.length - 1][points.length].originalY);
 
-        print("LENGTH: " + points.length + " SUB LENGTH: " + sampleSetLength);
-        print("SAMPLE LISTS POINTS:length: " + sampleSetLength +  " " + \
                points[points.length - 1][sampleSetLength].originalY);
-    }
-        points[points.length - 1][points.length] = { x: xValue, originalY: yValue, \
scaledY: yValue }; +//        print("LENGTH: " + points.length + " SUB LENGTH: " + \
sampleSetLength); +        print("OLDLENGTH: " + points.length);
+        points[points.length - 1].push(new Array());
+        sampleSetLength += 1;
+        print("NEWLENGTH: " + points.length);
+        points[points.length - 1][sampleSetLength - 1] = { x: xValue, originalY: \
yValue, scaledY: yValue }; +        print("SAMPLE LISTS POINTS:length: " + \
sampleSetLength +  " " + points[points.length - 1][sampleSetLength - 1].originalY);  
  //   downscaleOne(y);
 
@@ -295,8 +298,8 @@ function drawBarGraph()
         for(var j = 0; j < sampleSetLength; ++j) {
             var x;
             var y;
-            x = points[i][j + 1].x;
-            y = points[i][j + 1].scaledY;
+            x = points[i][j].x;
+            y = points[i][j].scaledY;
 
             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