[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:28:17
Message-ID: 20120216192817.2D77CA60A6 () git ! kde ! org
[Download RAW message or body]

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

initial multidimensional array/multiple sampleSets support per graph

canvas (e.g. upstream and downstream all in one graph, but plotted
differently with diff colors, etc.)

M  +29   -5    plasma/generic/applets/system-monitor/plotter/private/plotterpainter.js


http://commits.kde.org/kde-workspace/8f0eabaf59cc35cb9a6f438ddda623de0c63ac06

diff --git a/plasma/generic/applets/system-monitor/plotter/private/plotterpainter.js \
b/plasma/generic/applets/system-monitor/plotter/private/plotterpainter.js index \
                4815f59..5ce636a 100644
--- a/plasma/generic/applets/system-monitor/plotter/private/plotterpainter.js
+++ b/plasma/generic/applets/system-monitor/plotter/private/plotterpainter.js
@@ -24,8 +24,17 @@ var graphPadding;
 var horizSpace;
 var vertSpace;
 
-// [i][0] = x, [i][1] = y
-var points = [];
+/* actually a multidimensional array
+* array of arrays
+* each points[i] represents a sample set.
+* A sample set is an entire set of graph data that is logically
+* separated from everything all other sets. e.g. downstream and upstream,
+* read I/O and write I/O, etc. each points[i][j] indicates 1 dot/point
+* on that particular sampleSet
+*/
+var points = Array();
+var sampleSetLength = 0;
+
 var canvas;
 var context = null;
 
@@ -54,7 +63,7 @@ var pointMousedOver = false;
 // access via hoverText.bool = true, etc.
 var hoverText = {visible: false, x: 0, y: 0, clearNeeded: false}
 
-function addSample(y)
+function addSample(y, sampleSet)
 {
     // adding a new sample, making a new element that contains x and y
     // set x at a predefined interval (horizSpace)
@@ -62,7 +71,22 @@ function addSample(y)
 
     var yValue = y;
 
-    points.push({x: xValue, originalY: yValue, scaledY: yValue});
+    if (sampleSet > points.length - 1) {
+        points.push(new Array());
+        points[points.length - 1][points.length] = 22;
+
+        print(points[points.length - 1][points.length]);
+
+
+//        points[sampleSet].push( { x: xValue } );
+   //     points[sampleSet][0] = { test: " TEST" }
+//        points[sampleSet] = {test: 1,test2: 2 };
+//        points[sampleSet][points[sampleSet].length - 1] = { x: 50, originalY: 50, \
scaledY: 50 }; +
+    print("SAMPLE LISTS POINTS: " + points + " || " + points[sampleSet]);
+        //points[points.length - 1] = [ [ { x: 1, originalY: 2, scaledY: 1 } ], [ x: \
0 ] ]; +        //points.push({x: xValue, originalY: yValue, scaledY: yValue});
+    }
 
     downscaleOne(y);
 
@@ -179,7 +203,7 @@ function advancePlotter()
     debug("$$$$$$$ graphPadding: " + graphPadding);
     var yPos = (height * (yPercent / 100) + graphPadding * 2);
     debug("randomly generated y pos: " + yPos);
-    addSample(height - yPos);
+    addSample(height - yPos, 0);
 
     if ((points.length * horizSpace) >= width - graphPadding) {
         shiftLeft();


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

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