js/startscreen-fake.js
changeset 3 7fa607ed7e82
parent 2 0d947d167ec5
child 4 26a901771957
equal deleted inserted replaced
2:0d947d167ec5 3:7fa607ed7e82
   204                         + "L"
   204                         + "L"
   205                         + x
   205                         + x
   206                         + ","
   206                         + ","
   207                         + yscale * (mmso.start + 2 * mmso.duration / 3);
   207                         + yscale * (mmso.start + 2 * mmso.duration / 3);
   208                     }).join("L") + "L0,"+(yscale * data.duration);
   208                     }).join("L") + "L0,"+(yscale * data.duration);
   209                     sumpath.attr({
   209                     sumpatha.attr({ path: d });
   210                         path: d
   210                     sumpathb.attr({ path: d });
   211                     });
   211                     sumpatha.show();
   212                     sumpath.show();
   212                     sumpathb.show();
   213                 } else {
   213                 } else {
   214                     sumpath.hide();
   214                     sumpatha.hide();
       
   215                     sumpathb.hide();
   215                 }
   216                 }
   216             } else {
   217             } else {
   217                 for (var i = 0; i < nmmso; i++) {
   218                 for (var i = 0; i < nmmso; i++) {
   218                     var opacity = 0,
   219                     var opacity = 0,
   219                         rgb = [0,0,0];
   220                         rgb = [0,0,0];
   249             yscale = ph / data.duration,
   250             yscale = ph / data.duration,
   250             mx = Math.max.apply(Math, data.segments.map(function(s) { return s.tweet_rate})),
   251             mx = Math.max.apply(Math, data.segments.map(function(s) { return s.tweet_rate})),
   251             xscale = (pw - 10)/mx;
   252             xscale = (pw - 10)/mx;
   252         
   253         
   253         if (PATH_MODE) {
   254         if (PATH_MODE) {
   254             var sumpath = paper.path();
   255             var sumpatha = paper.path();
   255             sumpath.attr({
   256             sumpatha.attr({
   256                 fill: "#f0f0f0",
   257                 fill: "#f0f0f0",
   257                 stroke: "#666666",
   258                 stroke: "none"
   258                 "stroke-width": 2
       
   259             });
   259             });
   260             var topicpaths = data.topics.map(function(topic) {
   260             var topicpaths = data.topics.map(function(topic) {
   261                 var d = "M0,0L" + topic.scores.map(function(s, i) {
   261                 var d = "M0,0L" + topic.scores.map(function(s, i) {
   262                     var mmso = data.segments[i],
   262                     var mmso = data.segments[i],
   263                         x = xscale * s / mmso.duration;
   263                         x = xscale * s / mmso.duration;
   269                         + ","
   269                         + ","
   270                         + yscale * (mmso.start + 2 * mmso.duration / 3);
   270                         + yscale * (mmso.start + 2 * mmso.duration / 3);
   271                 }).join("L") + "L0,"+(yscale * data.duration);
   271                 }).join("L") + "L0,"+(yscale * data.duration);
   272                 return paper.path(d);
   272                 return paper.path(d);
   273             });
   273             });
       
   274             var sumpathb = paper.path();
       
   275             sumpathb.attr({
       
   276                 stroke: "#666666",
       
   277                 "stroke-width": 2
       
   278             });
   274         } else {
   279         } else {
   275             var segmentrects = data.segments.map(function(mmso) {
   280             var segmentrects = data.segments.map(function(mmso) {
   276                 var rect = paper.rect(0, yscale * mmso.start, pw - 50, yscale * mmso.duration);
   281                 var rect = paper.rect(0, yscale * mmso.start, pw - 50, yscale * mmso.duration);
   277                 rect.attr({stroke: "none"});
   282                 rect.attr({stroke: "none"});
   278                 return rect;
   283                 return rect;