src/widgets/Polemic.js
branchnew-model
changeset 883 d35ad8111c5e
parent 882 61c384dda19e
child 906 4b6e154ae8de
equal deleted inserted replaced
882:61c384dda19e 883:d35ad8111c5e
   222         
   222         
   223         var _x = 0,
   223         var _x = 0,
   224             _html = '',
   224             _html = '',
   225             _scale = this.max_elements * this.element_height / _max;
   225             _scale = this.max_elements * this.element_height / _max;
   226             
   226             
   227         function displayElement(_x, _y, _h, _color, _nums, _begin, _end) {
   227         function displayStackElement(_x, _y, _h, _color, _nums, _begin, _end) {
   228             _html += Mustache.to_html(
   228             _html += Mustache.to_html(
   229                 '<div class="Ldt-Polemic-TweetDiv" pos-x="{{posx}}" pos-y="{{top}}" annotation-counts="{{nums}}" begin-time="{{begin}}" end-time="{{end}}"'
   229                 '<div class="Ldt-Polemic-TweetDiv" pos-x="{{posx}}" pos-y="{{top}}" annotation-counts="{{nums}}" begin-time="{{begin}}" end-time="{{end}}"'
   230                 + ' style="width: {{width}}px; height: {{height}}px; top: {{top}}px; left: {{left}}px; background: {{color}}"></div>',
   230                 + ' style="width: {{width}}px; height: {{height}}px; top: {{top}}px; left: {{left}}px; background: {{color}}"></div>',
   231             {
   231             {
   232                 nums: _nums,
   232                 nums: _nums,
   247                     return _annotations.length
   247                     return _annotations.length
   248                 }).join(",");
   248                 }).join(",");
   249             if (_slice.annotations.length) {
   249             if (_slice.annotations.length) {
   250                 var _h = Math.ceil(_scale * _slice.annotations.length);
   250                 var _h = Math.ceil(_scale * _slice.annotations.length);
   251                 _y -= _h;
   251                 _y -= _h;
   252                 displayElement(_x, _y, _h, _this.defaultcolor, _nums, _slice.begin, _slice.end);
   252                 displayStackElement(_x, _y, _h, _this.defaultcolor, _nums, _slice.begin, _slice.end);
   253             }
   253             }
   254             IriSP._(_slice.polemicStacks).forEach(function(_annotations, _j) {
   254             IriSP._(_slice.polemicStacks).forEach(function(_annotations, _j) {
   255                 if (_annotations.length) {
   255                 if (_annotations.length) {
   256                     var _color = _this.polemics[_j].color,
   256                     var _color = _this.polemics[_j].color,
   257                         _h = Math.ceil(_scale * _annotations.length);
   257                         _h = Math.ceil(_scale * _annotations.length);
   258                     _y -= _h;
   258                     _y -= _h;
   259                     displayElement(_x, _y, _h, _color, _nums, _slice.begin, _slice.end);
   259                     displayStackElement(_x, _y, _h, _color, _nums, _slice.begin, _slice.end);
   260                 }
   260                 }
   261             });
   261             });
   262             _x += _this.element_width;
   262             _x += _this.element_width;
   263         });
   263         });
   264         
   264