# HG changeset patch # User rougeronj # Date 1421657572 -3600 # Node ID a323578ea954b64dab616ce82381f1aa6e140ff4 # Parent 09a9074ea7b06a4753bca78ec7b848a278fceb12 generalview take interval in pixel as argument (not time anymore) diff -r 09a9074ea7b0 -r a323578ea954 client/annotviz/app/js/generalView.js --- a/client/annotviz/app/js/generalView.js Fri Jan 16 22:09:56 2015 +0100 +++ b/client/annotviz/app/js/generalView.js Mon Jan 19 09:52:52 2015 +0100 @@ -10,7 +10,7 @@ var PIXI = require('pixi'); var randomColor = require('randomColor'); -function GeneralView(parentContainer, xInit, yInit, width, height, duration, interval, beginTime){ +function GeneralView(parentContainer, xInit, yInit, width, height, timeBegin, timeEnd, intervalSize){ console.log(width); var _this = this; this.container = new PIXI.DisplayObjectContainer(); @@ -20,15 +20,16 @@ this.container.height = height; parentContainer.addChild(this.container); - this.duration = duration; - this.beginTime = beginTime; + this.timeBegin = timeBegin; + this.timeEnd = timeEnd; + this.duration = (timeEnd - timeBegin)/1000 this.width = width; this.height = height; //define interval corresponding to the time of one step //e.g: 60 for a step of 60 seconds - this.interval = interval; + this.intervalSize = intervalSize; // define the step depending the interval we passed and the duration - this.step = width*interval/duration; + this.intervalDuration = (intervalSize*this.duration/width); //Initialise the list of step //each cell will contain the list categories and the number of annotations per categories @@ -45,7 +46,7 @@ this.container.addChild(graphics); this.addAnnot = function(category, time){ - var x = Math.floor( (time-this.beginTime)/(1000*this.interval)) * this.step; + var x = Math.floor( (time-this.timeBegin)/(1000*this.intervalDuration)) * this.intervalSize; var y = (-this.height/2); //Check if cell is already set. @@ -66,7 +67,7 @@ // We draw the rectangle var graphics = new PIXI.Graphics(); graphics.beginFill(0x536991); - graphics.drawRect(x, y, this.step, -10); + graphics.drawRect(x, y, this.intervalSize, -10); graphics.endFill(); this.container.addChild(graphics); diff -r 09a9074ea7b0 -r a323578ea954 client/annotviz/app/js/main.js --- a/client/annotviz/app/js/main.js Fri Jan 16 22:09:56 2015 +0100 +++ b/client/annotviz/app/js/main.js Mon Jan 19 09:52:52 2015 +0100 @@ -58,7 +58,7 @@ uberContainer.position.y = 0; } else { uberContainer.position.x = 0; - uberContainer.position.y = Math.floor(sceneHeight*9/10);; + uberContainer.position.y = Math.floor(sceneHeight*9/10); } stage.addChild(uberContainer); @@ -146,7 +146,7 @@ var GeneralView = require('./generalView.js') -var GeneralRoll = new GeneralView(uberContainer, 0, 0, sceneWidth - (prSize2 + prSize3), sceneHeight, 3600, 60, Date.now()); +var GeneralRoll = new GeneralView(uberContainer, 0, 0, sceneWidth - (prSize2 + prSize3), sceneHeight, Date.now(), Date.now() + 300000, 30); function addAnnots(data){