tweetcast/nodejs/client/js/script.js
changeset 335 5f83c21dee69
parent 334 b7f05d66b620
child 336 d60efd677b50
--- a/tweetcast/nodejs/client/js/script.js	Tue Oct 25 09:36:21 2011 +0200
+++ b/tweetcast/nodejs/client/js/script.js	Tue Oct 25 14:48:22 2011 +0200
@@ -11,19 +11,6 @@
         "posIndex" : [],
         "tlChanged" : true
     },
-    colors = {
-        'positive' : "#1D973D",
-        'reference' : "#C5A62D",
-        'negative' : "#CE0A15",
-        'question' : "#036AAE",
-        'neutre' : "#585858"
-    },
-    annotations = {
-        'positive' : '++',
-        'negative' : '--',
-        'reference' : '==',
-        'question' : '??'
-    },
     displaySplitting = [
         {
             positions : [ 10, 20, 22, 24, 25, 26, 27, 28, 29, 31, 33, 43, 53 ],
@@ -51,7 +38,7 @@
 	if (tweet.annotations.length) {
 	    html += '<div class="annotations">';
 	    for (var i in tweet.annotations) {
-    		html += '<div class="annotation ' + tweet.annotations[i] + '" style="width :' + (100/tweet.annotations.length) + '%"></div>';
+    		html += '<div class="annotation" style="width:' + (100/tweet.annotations.length) + '%; background:' + annotations[tweet.annotations[i]].colors.tweet + '"></div>';
     	}
     	html += '</div>';
 	}
@@ -240,16 +227,16 @@
             tlPaper.text(165, posY, new Date(tweetData.timeline[i].start).toLocaleTimeString()).attr({ "text-anchor" : "start", "font-size": "12px" });
         }
         var anz = {
-            "neutre" :tweetData.timeline[i].tweets
+            "default" :tweetData.timeline[i].tweets
         };
         for (var j in tweetData.timeline[i].annotations) {
-            anz.neutre -= tweetData.timeline[i].annotations[j];
+            anz.default -= tweetData.timeline[i].annotations[j];
             anz[j] = tweetData.timeline[i].annotations[j];
         }
         var posX = 0;
         for (var j in anz) {
             var largX = scaleX * anz[j];
-            tlPaper.rect(posX, 600 - scaleY * (i+1), largX, scaleY).attr({"stroke": "none", "fill": colors[j]});
+            tlPaper.rect(posX, 600 - scaleY * (i+1), largX, scaleY).attr({"stroke": "none", "fill": annotations[j].colors.timeline});
             posX += largX;
         }
     }