--- a/integ/iri/js/iri-buzz.js Tue Apr 30 15:55:54 2013 +0200
+++ b/integ/iri/js/iri-buzz.js Tue Apr 30 18:22:21 2013 +0200
@@ -5,17 +5,17 @@
var config = {
partnerCode: 'B00015838755',
originalDuration: 24 * HOURS,
- vizDuration: 10 * MINUTES,
+ vizDuration: 8 * MINUTES,
colorIds: {
"-2.0": 2,
"0.5": 0, "1.0": 0, "1.5": 0, "2.0": 0,
"2.5": 1, "3.0": 1, "3.5": 1,
"4.0": 2, "4.5": 2, "5.0": 2
},
- movieCount: 15,
- opinionsPerPage: 20,
+ movieCount: 10,
+ opinionsPerPage: 100,
colors: [ "#f62a43", "#f3c000", "#2d9252"],
- refreshRate: 200,
+ refreshRate: 500,
columnSpacing: 40,
columnWidth: 150,
tokenHeight: 16
@@ -74,8 +74,6 @@
function startViz() {
- var barChart = undefined;
-
opinions.sort(function(a,b) {
return a._timestamp > b._timestamp;
});
@@ -85,8 +83,11 @@
height : vsHeight,
chart : {
spacer : config.columnSpacing / 2,
- y: 100,
- height: vsHeight - 100
+ y: 0,
+ height: vsHeight
+ },
+ options : {
+ layout: false
},
data : {
model : movies.map(function(movie) {
@@ -155,6 +156,8 @@
},
callback:{
suspension: function(token) {
+ var currentT = config.refreshRate * token.attr("t");
+ deltaT = Date.now() - currentT;
setTimeout(function() {
token.flocculate();
barChart.strata.update(barChart);
@@ -172,7 +175,7 @@
}
},
aggregation:{
- height: vsHeight - 100,
+ height: vsHeight - 80,
maxData: Math.max.apply(Math, movies.map(function(m) { return m.opinions.length; }))
},
suspension:{
@@ -183,16 +186,19 @@
}
}
- //console.log(barChartSettings);
+ console.log(barChartSettings);
- barChart = $("#data-viz").vs(barChartSettings).data('visualSedimentation');
- var startOfViz = Date.now();
+ var barChart = $("#data-viz").vs(barChartSettings).data('visualSedimentation');
+
+ $(".timer-bar-value").width(0);
+
clearInterval(clockInterval);
- $(".timer-bar-value").width(0);
+ deltaT = Date.now();
clockInterval = setInterval(function() {
- $(".timer-bar-value").width($('.timer-bar').width() * Math.min(1, (Date.now() - startOfViz) / config.vizDuration));
- },
- 100);
+ var t = Date.now() - deltaT,
+ w = $('.timer-bar').width() * Math.min(1, t / config.vizDuration);
+ $(".timer-bar-value").width(w);
+ }, 200);
}
function loadMovie(movie) {
@@ -243,7 +249,23 @@
}
);
}
-
+
+ var acimgserv = 0, acimgservcount = 6;
+
+ function resizeAcPicture(pic, w, h) {
+ var path = pic.path || pic.href || pic || "";
+ if (/^https?:\/\//.test(path)) {
+ path = path.replace(/^https?:\/\/[^\/]+/,'');
+ }
+ return "http://fr.web.img"
+ + ( 1 + (acimgserv++ % acimgservcount))
+ + ".acsta.net/r_"
+ + w
+ + "_"
+ + h
+ + path;
+ }
+
$.getJSON(
"http://api.allocine.fr/rest/v3/movielist",
{
@@ -267,7 +289,7 @@
poster: movie.poster.href,
opinions: [],
opinionPage: 1
- }
+ };
});
moviesToLoad = movies.length;
movies.forEach(loadMovie);
@@ -275,7 +297,7 @@
return '<li style=" margin: 0 '
+ Math.floor(config.columnSpacing / 2)
+ 'px"><img width="150" height="200" src="'
- + movie.poster
+ + resizeAcPicture(movie.poster,150,200)
+ '" alt="'
+ movie.title
+'" /></li>';