author | rougeronj |
Thu, 22 Jan 2015 23:58:11 +0100 | |
changeset 126 | 13d9a532a0a7 |
parent 123 | d8ef840eaf68 |
child 127 | 0386fb9efe27 |
permissions | -rw-r--r-- |
91 | 1 |
/** |
100 | 2 |
* js/annotstimeline |
91 | 3 |
* |
100 | 4 |
* annotstimeline basic component |
91 | 5 |
* |
6 |
*/ |
|
7 |
||
8 |
'use strict'; |
|
9 |
||
10 |
var PIXI = require('pixi'); |
|
105
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
103
diff
changeset
|
11 |
var Utils = require('./utils.js'); |
100 | 12 |
var _ = require('lodash'); |
97 | 13 |
|
109
8546e2181a73
correct color codes sent by client
ymh <ymh.work@gmail.com>
parents:
105
diff
changeset
|
14 |
var defaultOptions = { |
100 | 15 |
logger: undefined, |
16 |
intervalWidth: 10, |
|
17 |
intervalHeight: 5, |
|
102 | 18 |
maxCellHeight: 200, |
126
13d9a532a0a7
Add timeline of the 2nd day - take out from the clock annotstimeline and put it in annotsvizview - make the clocks graphics optional through showClockGraphics
rougeronj
parents:
123
diff
changeset
|
19 |
radius: 300, |
13d9a532a0a7
Add timeline of the 2nd day - take out from the clock annotstimeline and put it in annotsvizview - make the clocks graphics optional through showClockGraphics
rougeronj
parents:
123
diff
changeset
|
20 |
showClockGraphics: true |
100 | 21 |
}; |
97 | 22 |
|
23 |
||
100 | 24 |
function AnnotsTimeLine(options){ |
91 | 25 |
var _this = this; |
100 | 26 |
var opts = _(options).defaults(defaultOptions).value(); |
109
8546e2181a73
correct color codes sent by client
ymh <ymh.work@gmail.com>
parents:
105
diff
changeset
|
27 |
|
100 | 28 |
this.container = new PIXI.DisplayObjectContainer(); |
29 |
this.container.x = opts.xInit; |
|
30 |
this.container.y = opts.yInit; |
|
31 |
this.container.width = opts.width; |
|
109
8546e2181a73
correct color codes sent by client
ymh <ymh.work@gmail.com>
parents:
105
diff
changeset
|
32 |
this.container.height = opts.height; |
8546e2181a73
correct color codes sent by client
ymh <ymh.work@gmail.com>
parents:
105
diff
changeset
|
33 |
|
100 | 34 |
this.timeBegin = opts.timeBegin; |
35 |
this.timeEnd = opts.timeEnd; |
|
36 |
this.duration = (this.timeEnd - this.timeBegin)/1000; |
|
37 |
this.width = opts.width; |
|
38 |
this.height = opts.height; |
|
39 |
this.intervalHeight = opts.intervalHeight; |
|
40 |
this.intervalWidth = opts.intervalWidth; |
|
41 |
this.maxCellHeight = opts.maxCellHeight; |
|
42 |
this.annotCategories = opts.annotCategories; |
|
126
13d9a532a0a7
Add timeline of the 2nd day - take out from the clock annotstimeline and put it in annotsvizview - make the clocks graphics optional through showClockGraphics
rougeronj
parents:
123
diff
changeset
|
43 |
this.showClockGraphics = opts.showClockGraphics; |
121
df6b39f962bc
Add getAnnotCategories to utils and propagate the modification to annotsvizview and annotstimeline
rougeronj
parents:
114
diff
changeset
|
44 |
|
103 | 45 |
this.circleX = opts.circleX || (this.width/2); |
46 |
this.circleY = opts.circleY || (this.height/2); |
|
102 | 47 |
this.radius = opts.radius; |
126
13d9a532a0a7
Add timeline of the 2nd day - take out from the clock annotstimeline and put it in annotsvizview - make the clocks graphics optional through showClockGraphics
rougeronj
parents:
123
diff
changeset
|
48 |
var perimeter = 2*Math.PI* this.radius; |
13d9a532a0a7
Add timeline of the 2nd day - take out from the clock annotstimeline and put it in annotsvizview - make the clocks graphics optional through showClockGraphics
rougeronj
parents:
123
diff
changeset
|
49 |
this.intervalDuration = (this.intervalWidth * this.duration / perimeter); |
13d9a532a0a7
Add timeline of the 2nd day - take out from the clock annotstimeline and put it in annotsvizview - make the clocks graphics optional through showClockGraphics
rougeronj
parents:
123
diff
changeset
|
50 |
|
13d9a532a0a7
Add timeline of the 2nd day - take out from the clock annotstimeline and put it in annotsvizview - make the clocks graphics optional through showClockGraphics
rougeronj
parents:
123
diff
changeset
|
51 |
var totalIndex = Math.floor( perimeter/this.intervalWidth); |
109
8546e2181a73
correct color codes sent by client
ymh <ymh.work@gmail.com>
parents:
105
diff
changeset
|
52 |
|
91 | 53 |
this.cells = [] |
126
13d9a532a0a7
Add timeline of the 2nd day - take out from the clock annotstimeline and put it in annotsvizview - make the clocks graphics optional through showClockGraphics
rougeronj
parents:
123
diff
changeset
|
54 |
for (var i=0; i<(perimeter/this.intervalWidth) ; i++){ |
99
9d968fbcaa2a
Add General Time Line + minor change in annotsRoll
rougeronj
parents:
92
diff
changeset
|
55 |
this.cells[i] = []; |
103 | 56 |
this.cells[i].i = i; |
99
9d968fbcaa2a
Add General Time Line + minor change in annotsRoll
rougeronj
parents:
92
diff
changeset
|
57 |
this.cells[i].totalAnnots = 0; |
9d968fbcaa2a
Add General Time Line + minor change in annotsRoll
rougeronj
parents:
92
diff
changeset
|
58 |
this.cells[i].categories = {}; |
9d968fbcaa2a
Add General Time Line + minor change in annotsRoll
rougeronj
parents:
92
diff
changeset
|
59 |
} |
109
8546e2181a73
correct color codes sent by client
ymh <ymh.work@gmail.com>
parents:
105
diff
changeset
|
60 |
|
100 | 61 |
var ws = opts.ws; |
62 |
var stageView = opts.stageView; |
|
102 | 63 |
|
103 | 64 |
//draw the base - circle and line to locate the scene |
91 | 65 |
var graphics = new PIXI.Graphics(); |
105
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
103
diff
changeset
|
66 |
graphics.lineStyle(2, 0x646464) |
103 | 67 |
.drawCircle(this.circleX, this.circleY, this.radius - 3) |
102 | 68 |
.endFill() |
91 | 69 |
this.container.addChild(graphics); |
109
8546e2181a73
correct color codes sent by client
ymh <ymh.work@gmail.com>
parents:
105
diff
changeset
|
70 |
|
100 | 71 |
stageView.registerComponent(this); |
97 | 72 |
|
99
9d968fbcaa2a
Add General Time Line + minor change in annotsRoll
rougeronj
parents:
92
diff
changeset
|
73 |
//Add Annotation to the TimeLine |
126
13d9a532a0a7
Add timeline of the 2nd day - take out from the clock annotstimeline and put it in annotsvizview - make the clocks graphics optional through showClockGraphics
rougeronj
parents:
123
diff
changeset
|
74 |
this.addAnnot = function(data){ |
123
d8ef840eaf68
get the correct json category depending on the timestamp
rougeronj
parents:
121
diff
changeset
|
75 |
var ts = Date.parse(data.ts); |
d8ef840eaf68
get the correct json category depending on the timestamp
rougeronj
parents:
121
diff
changeset
|
76 |
var colorsDef; |
d8ef840eaf68
get the correct json category depending on the timestamp
rougeronj
parents:
121
diff
changeset
|
77 |
_(this.annotCategories).eachRight(function(cdef) { |
d8ef840eaf68
get the correct json category depending on the timestamp
rougeronj
parents:
121
diff
changeset
|
78 |
if(cdef.ts < ts) { |
d8ef840eaf68
get the correct json category depending on the timestamp
rougeronj
parents:
121
diff
changeset
|
79 |
colorsDef = cdef; |
d8ef840eaf68
get the correct json category depending on the timestamp
rougeronj
parents:
121
diff
changeset
|
80 |
return false; |
d8ef840eaf68
get the correct json category depending on the timestamp
rougeronj
parents:
121
diff
changeset
|
81 |
} |
d8ef840eaf68
get the correct json category depending on the timestamp
rougeronj
parents:
121
diff
changeset
|
82 |
}); |
126
13d9a532a0a7
Add timeline of the 2nd day - take out from the clock annotstimeline and put it in annotsvizview - make the clocks graphics optional through showClockGraphics
rougeronj
parents:
123
diff
changeset
|
83 |
if (this.timeEnd > ts){ |
13d9a532a0a7
Add timeline of the 2nd day - take out from the clock annotstimeline and put it in annotsvizview - make the clocks graphics optional through showClockGraphics
rougeronj
parents:
123
diff
changeset
|
84 |
var i = Math.floor((ts - this.timeBegin)/(1000*this.intervalDuration)); |
121
df6b39f962bc
Add getAnnotCategories to utils and propagate the modification to annotsvizview and annotstimeline
rougeronj
parents:
114
diff
changeset
|
85 |
if (typeof(this.cells[i].graphics) === 'undefined'){ |
123
d8ef840eaf68
get the correct json category depending on the timestamp
rougeronj
parents:
121
diff
changeset
|
86 |
this.initCell(this.cells[i], colorsDef); |
121
df6b39f962bc
Add getAnnotCategories to utils and propagate the modification to annotsvizview and annotstimeline
rougeronj
parents:
114
diff
changeset
|
87 |
} |
df6b39f962bc
Add getAnnotCategories to utils and propagate the modification to annotsvizview and annotstimeline
rougeronj
parents:
114
diff
changeset
|
88 |
|
123
d8ef840eaf68
get the correct json category depending on the timestamp
rougeronj
parents:
121
diff
changeset
|
89 |
if (typeof(colorsDef.colors[data.content.category.code]) !== 'undefined'){ |
121
df6b39f962bc
Add getAnnotCategories to utils and propagate the modification to annotsvizview and annotstimeline
rougeronj
parents:
114
diff
changeset
|
90 |
var annotCode = data.content.category.code; |
df6b39f962bc
Add getAnnotCategories to utils and propagate the modification to annotsvizview and annotstimeline
rougeronj
parents:
114
diff
changeset
|
91 |
} else { |
df6b39f962bc
Add getAnnotCategories to utils and propagate the modification to annotsvizview and annotstimeline
rougeronj
parents:
114
diff
changeset
|
92 |
var annotCode = 'default'; |
df6b39f962bc
Add getAnnotCategories to utils and propagate the modification to annotsvizview and annotstimeline
rougeronj
parents:
114
diff
changeset
|
93 |
} |
df6b39f962bc
Add getAnnotCategories to utils and propagate the modification to annotsvizview and annotstimeline
rougeronj
parents:
114
diff
changeset
|
94 |
|
100 | 95 |
this.cells[i].categories[annotCode].count += 1; |
96 |
this.cells[i].totalAnnots +=1; |
|
123
d8ef840eaf68
get the correct json category depending on the timestamp
rougeronj
parents:
121
diff
changeset
|
97 |
this.redrawCell(this.cells[i], colorsDef); |
100 | 98 |
} |
99
9d968fbcaa2a
Add General Time Line + minor change in annotsRoll
rougeronj
parents:
92
diff
changeset
|
99 |
}; |
109
8546e2181a73
correct color codes sent by client
ymh <ymh.work@gmail.com>
parents:
105
diff
changeset
|
100 |
|
126
13d9a532a0a7
Add timeline of the 2nd day - take out from the clock annotstimeline and put it in annotsvizview - make the clocks graphics optional through showClockGraphics
rougeronj
parents:
123
diff
changeset
|
101 |
this.initClockGraphics = function() { |
105
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
103
diff
changeset
|
102 |
var tBeg = new PIXI.Text(Utils.formatTime(this.timeBegin), { font: '12pt Gothic Standard', fill: '#646464' }); |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
103
diff
changeset
|
103 |
tBeg.x = this.circleX + 15; |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
103
diff
changeset
|
104 |
tBeg.y = this.circleY - this.radius - this.maxCellHeight - 10; |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
103
diff
changeset
|
105 |
this.container.addChild(tBeg); |
109
8546e2181a73
correct color codes sent by client
ymh <ymh.work@gmail.com>
parents:
105
diff
changeset
|
106 |
|
105
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
103
diff
changeset
|
107 |
var tEnd = new PIXI.Text(Utils.formatTime(this.timeEnd), { font: '12pt Gothic Standard', fill: '#646464' }); |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
103
diff
changeset
|
108 |
tEnd.x = this.circleX - 15 - tEnd.width; |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
103
diff
changeset
|
109 |
tEnd.y = this.circleY - this.radius - this.maxCellHeight - 10; |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
103
diff
changeset
|
110 |
this.container.addChild(tEnd); |
109
8546e2181a73
correct color codes sent by client
ymh <ymh.work@gmail.com>
parents:
105
diff
changeset
|
111 |
|
105
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
103
diff
changeset
|
112 |
var t15 = new PIXI.Text(Utils.formatTime(((this.timeEnd - this.timeBegin)/4) + this.timeBegin), { font: '12pt Gothic Standard', fill: '#646464' }); |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
103
diff
changeset
|
113 |
t15.x = this.circleX + this.radius + this.maxCellHeight + 10 ; |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
103
diff
changeset
|
114 |
t15.y = this.circleY - t15.height; |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
103
diff
changeset
|
115 |
t15.rotation = Math.PI /2; |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
103
diff
changeset
|
116 |
this.container.addChild(t15); |
109
8546e2181a73
correct color codes sent by client
ymh <ymh.work@gmail.com>
parents:
105
diff
changeset
|
117 |
|
105
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
103
diff
changeset
|
118 |
var t30 = new PIXI.Text(Utils.formatTime(((this.timeEnd - this.timeBegin)/2) + this.timeBegin), { font: '12pt Gothic Standard', fill: '#646464' }); |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
103
diff
changeset
|
119 |
t30.x = this.circleX - t30.width/2; |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
103
diff
changeset
|
120 |
t30.y = this.circleY + this.radius + this.maxCellHeight - 2; |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
103
diff
changeset
|
121 |
this.container.addChild(t30); |
109
8546e2181a73
correct color codes sent by client
ymh <ymh.work@gmail.com>
parents:
105
diff
changeset
|
122 |
|
105
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
103
diff
changeset
|
123 |
var t45 = new PIXI.Text(Utils.formatTime(((this.timeEnd - this.timeBegin)*3/4) + this.timeBegin), { font: '12pt Gothic Standard', fill: '#646464' }); |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
103
diff
changeset
|
124 |
t45.x = this.circleX - this.radius - this.maxCellHeight - 10 ; |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
103
diff
changeset
|
125 |
t45.y = this.circleY + t15.height; |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
103
diff
changeset
|
126 |
t45.rotation = -Math.PI/2; |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
103
diff
changeset
|
127 |
this.container.addChild(t45); |
126
13d9a532a0a7
Add timeline of the 2nd day - take out from the clock annotstimeline and put it in annotsvizview - make the clocks graphics optional through showClockGraphics
rougeronj
parents:
123
diff
changeset
|
128 |
|
13d9a532a0a7
Add timeline of the 2nd day - take out from the clock annotstimeline and put it in annotsvizview - make the clocks graphics optional through showClockGraphics
rougeronj
parents:
123
diff
changeset
|
129 |
var lineV = new PIXI.Graphics(); |
13d9a532a0a7
Add timeline of the 2nd day - take out from the clock annotstimeline and put it in annotsvizview - make the clocks graphics optional through showClockGraphics
rougeronj
parents:
123
diff
changeset
|
130 |
lineV.lineStyle(1, 0x646464) |
13d9a532a0a7
Add timeline of the 2nd day - take out from the clock annotstimeline and put it in annotsvizview - make the clocks graphics optional through showClockGraphics
rougeronj
parents:
123
diff
changeset
|
131 |
.moveTo(this.circleX, this.circleY - (this.radius/3)/2) |
13d9a532a0a7
Add timeline of the 2nd day - take out from the clock annotstimeline and put it in annotsvizview - make the clocks graphics optional through showClockGraphics
rougeronj
parents:
123
diff
changeset
|
132 |
.lineTo(this.circleX, this.circleY - this.radius - this.maxCellHeight - 10) |
13d9a532a0a7
Add timeline of the 2nd day - take out from the clock annotstimeline and put it in annotsvizview - make the clocks graphics optional through showClockGraphics
rougeronj
parents:
123
diff
changeset
|
133 |
.endFill(); |
13d9a532a0a7
Add timeline of the 2nd day - take out from the clock annotstimeline and put it in annotsvizview - make the clocks graphics optional through showClockGraphics
rougeronj
parents:
123
diff
changeset
|
134 |
this.container.addChild(lineV); |
105
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
103
diff
changeset
|
135 |
} |
109
8546e2181a73
correct color codes sent by client
ymh <ymh.work@gmail.com>
parents:
105
diff
changeset
|
136 |
|
99
9d968fbcaa2a
Add General Time Line + minor change in annotsRoll
rougeronj
parents:
92
diff
changeset
|
137 |
//Draw the cellule |
123
d8ef840eaf68
get the correct json category depending on the timestamp
rougeronj
parents:
121
diff
changeset
|
138 |
this.redrawCell = function(cell, colorsDef){ |
102 | 139 |
var y = 0; |
109
8546e2181a73
correct color codes sent by client
ymh <ymh.work@gmail.com>
parents:
105
diff
changeset
|
140 |
|
99
9d968fbcaa2a
Add General Time Line + minor change in annotsRoll
rougeronj
parents:
92
diff
changeset
|
141 |
//Check if total height is higher than Max Cell Height |
9d968fbcaa2a
Add General Time Line + minor change in annotsRoll
rougeronj
parents:
92
diff
changeset
|
142 |
if ((cell.totalAnnots*this.intervalHeight) > this.maxCellHeight){ |
9d968fbcaa2a
Add General Time Line + minor change in annotsRoll
rougeronj
parents:
92
diff
changeset
|
143 |
var heightStep = this.maxCellHeight/cell.totalAnnots; |
9d968fbcaa2a
Add General Time Line + minor change in annotsRoll
rougeronj
parents:
92
diff
changeset
|
144 |
} else { |
9d968fbcaa2a
Add General Time Line + minor change in annotsRoll
rougeronj
parents:
92
diff
changeset
|
145 |
var heightStep = this.intervalHeight; |
9d968fbcaa2a
Add General Time Line + minor change in annotsRoll
rougeronj
parents:
92
diff
changeset
|
146 |
} |
109
8546e2181a73
correct color codes sent by client
ymh <ymh.work@gmail.com>
parents:
105
diff
changeset
|
147 |
|
99
9d968fbcaa2a
Add General Time Line + minor change in annotsRoll
rougeronj
parents:
92
diff
changeset
|
148 |
//Draw the rect depending on the height step calculated |
123
d8ef840eaf68
get the correct json category depending on the timestamp
rougeronj
parents:
121
diff
changeset
|
149 |
for (var i=0; i< colorsDef.order.length; i++){ |
d8ef840eaf68
get the correct json category depending on the timestamp
rougeronj
parents:
121
diff
changeset
|
150 |
var currentCode = colorsDef.order[i]; |
100 | 151 |
cell.graphics.beginFill(cell.categories[currentCode].color.replace("#", "0x")) |
103 | 152 |
.drawRect(0, y, this.intervalWidth-1, -cell.categories[currentCode].count * heightStep) |
99
9d968fbcaa2a
Add General Time Line + minor change in annotsRoll
rougeronj
parents:
92
diff
changeset
|
153 |
.endFill(); |
100 | 154 |
y -= cell.categories[currentCode].count*heightStep; |
99
9d968fbcaa2a
Add General Time Line + minor change in annotsRoll
rougeronj
parents:
92
diff
changeset
|
155 |
} |
9d968fbcaa2a
Add General Time Line + minor change in annotsRoll
rougeronj
parents:
92
diff
changeset
|
156 |
} |
121
df6b39f962bc
Add getAnnotCategories to utils and propagate the modification to annotsvizview and annotstimeline
rougeronj
parents:
114
diff
changeset
|
157 |
|
123
d8ef840eaf68
get the correct json category depending on the timestamp
rougeronj
parents:
121
diff
changeset
|
158 |
this.initCell = function(cell, colorsDef){ |
121
df6b39f962bc
Add getAnnotCategories to utils and propagate the modification to annotsvizview and annotstimeline
rougeronj
parents:
114
diff
changeset
|
159 |
cell.graphics = new PIXI.Graphics(); |
df6b39f962bc
Add getAnnotCategories to utils and propagate the modification to annotsvizview and annotstimeline
rougeronj
parents:
114
diff
changeset
|
160 |
cell.graphics.position.x = this.circleX + this.radius * Math.sin(cell.i*(360/totalIndex)*(Math.PI/180)); |
df6b39f962bc
Add getAnnotCategories to utils and propagate the modification to annotsvizview and annotstimeline
rougeronj
parents:
114
diff
changeset
|
161 |
cell.graphics.position.y = this.circleY - this.radius * Math.cos(cell.i*(360/totalIndex)*(Math.PI/180)); |
df6b39f962bc
Add getAnnotCategories to utils and propagate the modification to annotsvizview and annotstimeline
rougeronj
parents:
114
diff
changeset
|
162 |
cell.graphics.rotation = (cell.i)*(360/totalIndex)*(Math.PI/180) + (360/(totalIndex*2))*(Math.PI/180); |
df6b39f962bc
Add getAnnotCategories to utils and propagate the modification to annotsvizview and annotstimeline
rougeronj
parents:
114
diff
changeset
|
163 |
this.container.addChild(cell.graphics); |
df6b39f962bc
Add getAnnotCategories to utils and propagate the modification to annotsvizview and annotstimeline
rougeronj
parents:
114
diff
changeset
|
164 |
|
123
d8ef840eaf68
get the correct json category depending on the timestamp
rougeronj
parents:
121
diff
changeset
|
165 |
for (var category in colorsDef.colors){ |
121
df6b39f962bc
Add getAnnotCategories to utils and propagate the modification to annotsvizview and annotstimeline
rougeronj
parents:
114
diff
changeset
|
166 |
cell.categories[category] = { |
df6b39f962bc
Add getAnnotCategories to utils and propagate the modification to annotsvizview and annotstimeline
rougeronj
parents:
114
diff
changeset
|
167 |
"count": 0, |
123
d8ef840eaf68
get the correct json category depending on the timestamp
rougeronj
parents:
121
diff
changeset
|
168 |
"color": colorsDef.colors[category] |
121
df6b39f962bc
Add getAnnotCategories to utils and propagate the modification to annotsvizview and annotstimeline
rougeronj
parents:
114
diff
changeset
|
169 |
}; |
df6b39f962bc
Add getAnnotCategories to utils and propagate the modification to annotsvizview and annotstimeline
rougeronj
parents:
114
diff
changeset
|
170 |
} |
126
13d9a532a0a7
Add timeline of the 2nd day - take out from the clock annotstimeline and put it in annotsvizview - make the clocks graphics optional through showClockGraphics
rougeronj
parents:
123
diff
changeset
|
171 |
if (typeof(cell.categories['default']) === 'undefined'){ |
13d9a532a0a7
Add timeline of the 2nd day - take out from the clock annotstimeline and put it in annotsvizview - make the clocks graphics optional through showClockGraphics
rougeronj
parents:
123
diff
changeset
|
172 |
cell.categories['default'] = { |
13d9a532a0a7
Add timeline of the 2nd day - take out from the clock annotstimeline and put it in annotsvizview - make the clocks graphics optional through showClockGraphics
rougeronj
parents:
123
diff
changeset
|
173 |
"count": 0, |
13d9a532a0a7
Add timeline of the 2nd day - take out from the clock annotstimeline and put it in annotsvizview - make the clocks graphics optional through showClockGraphics
rougeronj
parents:
123
diff
changeset
|
174 |
"color": colorsDef.defaultColor |
13d9a532a0a7
Add timeline of the 2nd day - take out from the clock annotstimeline and put it in annotsvizview - make the clocks graphics optional through showClockGraphics
rougeronj
parents:
123
diff
changeset
|
175 |
} |
121
df6b39f962bc
Add getAnnotCategories to utils and propagate the modification to annotsvizview and annotstimeline
rougeronj
parents:
114
diff
changeset
|
176 |
} |
df6b39f962bc
Add getAnnotCategories to utils and propagate the modification to annotsvizview and annotstimeline
rougeronj
parents:
114
diff
changeset
|
177 |
} |
109
8546e2181a73
correct color codes sent by client
ymh <ymh.work@gmail.com>
parents:
105
diff
changeset
|
178 |
|
100 | 179 |
this.init = function() { |
180 |
ws.message(function(data) { |
|
181 |
_this.addAnnot(data); |
|
182 |
}); |
|
109
8546e2181a73
correct color codes sent by client
ymh <ymh.work@gmail.com>
parents:
105
diff
changeset
|
183 |
|
126
13d9a532a0a7
Add timeline of the 2nd day - take out from the clock annotstimeline and put it in annotsvizview - make the clocks graphics optional through showClockGraphics
rougeronj
parents:
123
diff
changeset
|
184 |
if (this.showClockGraphics){this.initClockGraphics();} |
100 | 185 |
}; |
109
8546e2181a73
correct color codes sent by client
ymh <ymh.work@gmail.com>
parents:
105
diff
changeset
|
186 |
|
8546e2181a73
correct color codes sent by client
ymh <ymh.work@gmail.com>
parents:
105
diff
changeset
|
187 |
|
100 | 188 |
this.start = function() { |
91 | 189 |
}; |
109
8546e2181a73
correct color codes sent by client
ymh <ymh.work@gmail.com>
parents:
105
diff
changeset
|
190 |
|
100 | 191 |
this.refresh = function() { |
109
8546e2181a73
correct color codes sent by client
ymh <ymh.work@gmail.com>
parents:
105
diff
changeset
|
192 |
|
100 | 193 |
}; |
109
8546e2181a73
correct color codes sent by client
ymh <ymh.work@gmail.com>
parents:
105
diff
changeset
|
194 |
|
100 | 195 |
this.stop = function(){ |
103 | 196 |
console.log(this.cells); |
100 | 197 |
}; |
109
8546e2181a73
correct color codes sent by client
ymh <ymh.work@gmail.com>
parents:
105
diff
changeset
|
198 |
|
100 | 199 |
return this; |
91 | 200 |
} |
201 |
||
98 | 202 |
module.exports = { |
103 | 203 |
AnnotsTimeLine: AnnotsTimeLine |
98 | 204 |
}; |