src/widgets/Polemic.js
branchnew-model
changeset 906 4b6e154ae8de
parent 883 d35ad8111c5e
child 909 aa0e42229784
equal deleted inserted replaced
905:029a4efe9e24 906:4b6e154ae8de
   153             var _x = 0,
   153             var _x = 0,
   154                 _html = '';
   154                 _html = '';
   155             
   155             
   156             function displayElement(_x, _y, _color, _id, _title) {
   156             function displayElement(_x, _y, _color, _id, _title) {
   157                 _html += Mustache.to_html(
   157                 _html += Mustache.to_html(
   158                     '<div class="Ldt-Polemic-TweetDiv" annotation-id="{{id}}" tweet-title="{{title}}" pos-x="{{posx}}" pos-y="{{top}}" polemic-color="{{color}}"'
   158                     '<div class="Ldt-Polemic-TweetDiv Ldt-TraceMe" trace-info="annotation-id:{{id}}" annotation-id="{{id}}" tweet-title="{{title}}" pos-x="{{posx}}" pos-y="{{top}}" polemic-color="{{color}}"'
   159                     + ' style="width: {{width}}px; height: {{height}}px; top: {{top}}px; left: {{left}}px; background: {{color}}"></div>',
   159                     + ' style="width: {{width}}px; height: {{height}}px; top: {{top}}px; left: {{left}}px; background: {{color}}"></div>',
   160                 {
   160                 {
   161                     id: _id,
   161                     id: _id,
   162                     title: _title,
   162                     title: _title,
   163                     posx: Math.floor(_x + (_this.element_width - 1) / 2),
   163                     posx: Math.floor(_x + (_this.element_width - 1) / 2),
   171             
   171             
   172             IriSP._(_slices).forEach(function(_slice) {
   172             IriSP._(_slices).forEach(function(_slice) {
   173                 var _y = _this.height;
   173                 var _y = _this.height;
   174                 _slice.annotations.forEach(function(_annotation) {
   174                 _slice.annotations.forEach(function(_annotation) {
   175                     _y -= _this.element_height;
   175                     _y -= _this.element_height;
   176                     displayElement(_x, _y, _this.defaultcolor, _annotation.id, _annotation.title);
   176                     displayElement(_x, _y, _this.defaultcolor, _annotation.namespacedId.name, _annotation.title);
   177                 });
   177                 });
   178                 IriSP._(_slice.polemicStacks).forEach(function(_annotations, _j) {
   178                 IriSP._(_slice.polemicStacks).forEach(function(_annotations, _j) {
   179                     var _color = _this.polemics[_j].color;
   179                     var _color = _this.polemics[_j].color;
   180                     _annotations.forEach(function(_annotation) {
   180                     _annotations.forEach(function(_annotation) {
   181                         _y -= _this.element_height;
   181                         _y -= _this.element_height;
   182                         displayElement(_x, _y, _color, _annotation.id, _annotation.title);
   182                         displayElement(_x, _y, _color, _annotation.namespacedId.name, _annotation.title);
   183                     });
   183                     });
   184                 });
   184                 });
   185                 _x += _this.element_width;
   185                 _x += _this.element_width;
   186             });
   186             });
   187             
   187             
   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 displayStackElement(_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 Ldt-TraceMe" trace-info="annotation-block,time:{{begin}}" 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,
   233                 posx: Math.floor(_x + (_this.element_width - 1) / 2),
   233                 posx: Math.floor(_x + (_this.element_width - 1) / 2),
   234                 left: _x,
   234                 left: _x,