src/js/widgets/stackGraphWidget.js
author veltr
Wed, 11 Apr 2012 17:06:11 +0200
changeset 857 fa614dc66b0b
parent 842 4ae2247a59f4
permissions -rw-r--r--
Bugfix in Sparkline Widget
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
661
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
     1
IriSP.StackGraphWidget = function(Popcorn, config, Serializer) {
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
     2
  IriSP.Widget.call(this, Popcorn, config, Serializer);
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
     3
}
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
     4
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
     5
IriSP.StackGraphWidget.prototype = new IriSP.Widget();
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
     6
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
     7
IriSP.StackGraphWidget.prototype.draw = function() {
842
4ae2247a59f4 Changes for Cinecast
veltr
parents: 834
diff changeset
     8
    var _ = IriSP._;
675
82a5ebbedc83 Added a Tag Cloud Widget and corrected Stack Graph Widget
veltr
parents: 661
diff changeset
     9
    this.height =  this._config.height || 50;
661
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    10
    this.width = this.selector.width();
842
4ae2247a59f4 Changes for Cinecast
veltr
parents: 834
diff changeset
    11
    this.slices = this._config.slices || ~~(this.width/(this.streamgraph ? 20 : 5));
4ae2247a59f4 Changes for Cinecast
veltr
parents: 834
diff changeset
    12
    _(this.tags).each(function(_a) {
821
49013af6d50b IE 8 compatibility (using Underscore for Map and Reduce operations)
veltr
parents: 820
diff changeset
    13
        _a.regexp = new RegExp(_(_a.keywords).map(function(_k) {
661
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    14
            return _k.replace(/([\W])/gm,'\\$1');
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    15
        }).join("|"),"im")
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    16
    });
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    17
    this.paper = new Raphael(this.selector[0], this.width, this.height);
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    18
    this.groups = [];
842
4ae2247a59f4 Changes for Cinecast
veltr
parents: 834
diff changeset
    19
    this.duration = this.getDuration();
661
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    20
    
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    21
    var _annotationType = this._serializer.getTweets(),
842
4ae2247a59f4 Changes for Cinecast
veltr
parents: 834
diff changeset
    22
        _sliceDuration = ~~ ( this.duration / this.slices),
675
82a5ebbedc83 Added a Tag Cloud Widget and corrected Stack Graph Widget
veltr
parents: 661
diff changeset
    23
        _annotations = this._serializer._data.annotations,
842
4ae2247a59f4 Changes for Cinecast
veltr
parents: 834
diff changeset
    24
        _groupedAnnotations = _(_.range(this.slices)).map(function(_i) {
821
49013af6d50b IE 8 compatibility (using Underscore for Map and Reduce operations)
veltr
parents: 820
diff changeset
    25
            return _(_annotations).filter(function(_a){
675
82a5ebbedc83 Added a Tag Cloud Widget and corrected Stack Graph Widget
veltr
parents: 661
diff changeset
    26
                return (_a.begin <= (1 + _i) * _sliceDuration) && (_a.end >= _i * _sliceDuration)
82a5ebbedc83 Added a Tag Cloud Widget and corrected Stack Graph Widget
veltr
parents: 661
diff changeset
    27
            });
661
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    28
        }),
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    29
        _max = IriSP._(_groupedAnnotations).max(function(_g) {
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    30
            return _g.length
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    31
        }).length,
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    32
        _scale = this.height / _max,
842
4ae2247a59f4 Changes for Cinecast
veltr
parents: 834
diff changeset
    33
        _width = this.width / this.slices,
675
82a5ebbedc83 Added a Tag Cloud Widget and corrected Stack Graph Widget
veltr
parents: 661
diff changeset
    34
        _showTitle = !this._config.excludeTitle,
82a5ebbedc83 Added a Tag Cloud Widget and corrected Stack Graph Widget
veltr
parents: 661
diff changeset
    35
        _showDescription = !this._config.excludeDescription;
661
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    36
    
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    37
    
842
4ae2247a59f4 Changes for Cinecast
veltr
parents: 834
diff changeset
    38
    var _paths = _(this.tags).map(function() {
661
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    39
        return [];
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    40
    });
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    41
    _paths.push([]);
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    42
    
842
4ae2247a59f4 Changes for Cinecast
veltr
parents: 834
diff changeset
    43
    for (var i = 0; i < this.slices; i++) {
661
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    44
        var _group = _groupedAnnotations[i];
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    45
        if (_group) {
842
4ae2247a59f4 Changes for Cinecast
veltr
parents: 834
diff changeset
    46
            var _vol = _(this.tags).map(function() {
661
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    47
                return 0;
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    48
            });
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    49
            for (var j = 0; j < _group.length; j++){
675
82a5ebbedc83 Added a Tag Cloud Widget and corrected Stack Graph Widget
veltr
parents: 661
diff changeset
    50
           var _txt = (_showTitle ? _group[j].content.title : '') + ' ' + (_showDescription ? _group[j].content.description : '')
842
4ae2247a59f4 Changes for Cinecast
veltr
parents: 834
diff changeset
    51
                var _tags = _(this.tags).map(function(_tag) {
661
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    52
                        return (_txt.search(_tag.regexp) == -1 ? 0 : 1)
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    53
                    }),
821
49013af6d50b IE 8 compatibility (using Underscore for Map and Reduce operations)
veltr
parents: 820
diff changeset
    54
                    _nbtags = _(_tags).reduce(function(_a,_b) {
661
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    55
                        return _a + _b;
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    56
                    }, 0);
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    57
                if (_nbtags) {
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    58
                    IriSP._(_tags).each(function(_v, _k) {
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    59
                        _vol[_k] += (_v / _nbtags);
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    60
                    });
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    61
                }
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    62
            }
821
49013af6d50b IE 8 compatibility (using Underscore for Map and Reduce operations)
veltr
parents: 820
diff changeset
    63
            var _nbtags = _(_vol).reduce(function(_a,_b) {
661
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    64
                    return _a + _b;
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    65
                }, 0),
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    66
                _nbneutre = _group.length - _nbtags,
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    67
                _h = _nbneutre * _scale,
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    68
                _base = this.height - _h;
842
4ae2247a59f4 Changes for Cinecast
veltr
parents: 834
diff changeset
    69
            if (!this.streamgraph) {
661
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    70
                this.paper.rect(i * _width, _base, _width - 1, _h ).attr({
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    71
                    "stroke" : "none",
842
4ae2247a59f4 Changes for Cinecast
veltr
parents: 834
diff changeset
    72
                    "fill" : this.defaultcolor
661
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    73
                });
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    74
            }
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    75
           _paths[0].push(_base);
842
4ae2247a59f4 Changes for Cinecast
veltr
parents: 834
diff changeset
    76
            for (var j = 0; j < this.tags.length; j++) {
661
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    77
                _h = _vol[j] * _scale;
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    78
                _base = _base - _h;
842
4ae2247a59f4 Changes for Cinecast
veltr
parents: 834
diff changeset
    79
                if (!this.streamgraph) {
661
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    80
                    this.paper.rect(i * _width, _base, _width - 1, _h ).attr({
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    81
                        "stroke" : "none",
842
4ae2247a59f4 Changes for Cinecast
veltr
parents: 834
diff changeset
    82
                        "fill" : this.tags[j].color
661
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    83
                    });
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    84
                }
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    85
                _paths[j+1].push(_base);
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    86
            }
821
49013af6d50b IE 8 compatibility (using Underscore for Map and Reduce operations)
veltr
parents: 820
diff changeset
    87
            this.groups.push(_(_vol).map(function(_v) {
661
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    88
                return _v / _group.length;
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    89
            }))
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    90
        } else {
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    91
            for (var j = 0; j < _paths.length; j++) {
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    92
                _paths[j].push(this.height);
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    93
            }
842
4ae2247a59f4 Changes for Cinecast
veltr
parents: 834
diff changeset
    94
            this.groups.push(_(this.tags).map(function() {
661
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    95
                return 0;
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    96
            }));
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    97
        }
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    98
    }
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
    99
    
842
4ae2247a59f4 Changes for Cinecast
veltr
parents: 834
diff changeset
   100
    if (this.streamgraph) {
661
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   101
        for (var j = _paths.length - 1; j >= 0; j--) {
821
49013af6d50b IE 8 compatibility (using Underscore for Map and Reduce operations)
veltr
parents: 820
diff changeset
   102
            var _d = _(_paths[j]).reduce(function(_memo, _v, _k) {
661
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   103
               return _memo + ( _k
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   104
                   ? 'C' + (_k * _width) + ' ' + _paths[j][_k - 1] + ' ' + (_k * _width) + ' ' + _v + ' ' + ((_k + .5) * _width) + ' ' + _v
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   105
                   : 'M0 ' + _v + 'L' + (.5*_width) + ' ' + _v )
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   106
            },'') + 'L' + this.width + ' ' + _paths[j][_paths[j].length - 1] + 'L' + this.width + ' ' + this.height + 'L0 ' + this.height;
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   107
            this.paper.path(_d).attr({
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   108
                "stroke" : "none",
842
4ae2247a59f4 Changes for Cinecast
veltr
parents: 834
diff changeset
   109
                "fill" : (j ? this.tags[j-1].color : this.defaultcolor)
661
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   110
            });
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   111
        }
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   112
    }
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   113
    this.rectangleFocus = this.paper.rect(0,0,_width,this.height)
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   114
        .attr({
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   115
            "stroke" : "none",
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   116
            "fill" : "#ff00ff",
766
aa26ddaf2556 fixed raphael's files to remove trailing colon at the end of objects to make
hamidouk
parents: 694
diff changeset
   117
            "opacity" : 0
661
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   118
        })
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   119
    this.rectangleProgress = this.paper.rect(0,0,0,this.height)
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   120
        .attr({
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   121
            "stroke" : "none",
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   122
            "fill" : "#808080",
766
aa26ddaf2556 fixed raphael's files to remove trailing colon at the end of objects to make
hamidouk
parents: 694
diff changeset
   123
            "opacity" : .3
661
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   124
        });
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   125
    this.ligneProgress = this.paper.path("M0 0L0 "+this.height).attr({"stroke":"#ff00ff", "line-width" : 2})
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   126
    
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   127
    this._Popcorn.listen("timeupdate", IriSP.wrap(this, this.timeUpdateHandler));
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   128
    var _this = this;
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   129
    this.selector
694
528626981afe corrected copy pasta code.
hamidouk
parents: 676
diff changeset
   130
        .click(IriSP.wrap(this, this.clickHandler))
830
18ca612e9ff0 Lots of changes
veltr
parents: 827
diff changeset
   131
        .mousemove(function(_e) {
18ca612e9ff0 Lots of changes
veltr
parents: 827
diff changeset
   132
            _this.updateTooltip(_e);
18ca612e9ff0 Lots of changes
veltr
parents: 827
diff changeset
   133
            // Trace
18ca612e9ff0 Lots of changes
veltr
parents: 827
diff changeset
   134
            var relX = _e.pageX - _this.selector.offset().left;
842
4ae2247a59f4 Changes for Cinecast
veltr
parents: 834
diff changeset
   135
            var _duration = _this.getDuration();
830
18ca612e9ff0 Lots of changes
veltr
parents: 827
diff changeset
   136
            var _time = parseInt((relX / _this.width) * _duration);
18ca612e9ff0 Lots of changes
veltr
parents: 827
diff changeset
   137
            _this._Popcorn.trigger("IriSP.TraceWidget.MouseEvents", {
18ca612e9ff0 Lots of changes
veltr
parents: 827
diff changeset
   138
                "widget" : "StackGraphWidget",
18ca612e9ff0 Lots of changes
veltr
parents: 827
diff changeset
   139
                "type": "mousemove",
18ca612e9ff0 Lots of changes
veltr
parents: 827
diff changeset
   140
                "x": _e.pageX,
18ca612e9ff0 Lots of changes
veltr
parents: 827
diff changeset
   141
                "y": _e.pageY,
18ca612e9ff0 Lots of changes
veltr
parents: 827
diff changeset
   142
                "time": _time
18ca612e9ff0 Lots of changes
veltr
parents: 827
diff changeset
   143
            });
676
499d9693d066 Merge with 835f5f454595a1097dc0cef85b987541c3b707ac
veltr
parents: 675 673
diff changeset
   144
661
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   145
        })
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   146
        .mouseout(function() {
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   147
            _this.TooltipWidget.hide();
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   148
            _this.rectangleFocus.attr({
766
aa26ddaf2556 fixed raphael's files to remove trailing colon at the end of objects to make
hamidouk
parents: 694
diff changeset
   149
                "opacity" : 0
661
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   150
            })
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   151
        })
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   152
}
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   153
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   154
IriSP.StackGraphWidget.prototype.timeUpdateHandler = function() {
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   155
    var _currentTime = this._Popcorn.currentTime(),
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   156
        _x = (1000 * _currentTime / this.duration) * this.width;
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   157
    this.rectangleProgress.attr({
766
aa26ddaf2556 fixed raphael's files to remove trailing colon at the end of objects to make
hamidouk
parents: 694
diff changeset
   158
        "width" : _x
661
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   159
    });
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   160
    this.ligneProgress.attr({
766
aa26ddaf2556 fixed raphael's files to remove trailing colon at the end of objects to make
hamidouk
parents: 694
diff changeset
   161
        "path" : "M" + _x + " 0L" + _x + " " + this.height
661
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   162
    })
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   163
}
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   164
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   165
IriSP.StackGraphWidget.prototype.clickHandler = function(event) {
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   166
  /* Ctrl-C Ctrl-V'ed from another widget
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   167
  */
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   168
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   169
  var relX = event.pageX - this.selector.offset().left;
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   170
  var newTime = ((relX / this.width) * this.duration/1000).toFixed(2);
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   171
  this._Popcorn.trigger("IriSP.StackGraphWidget.clicked", newTime);
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   172
  this._Popcorn.currentTime(newTime);                                 
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   173
};
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   174
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   175
IriSP.StackGraphWidget.prototype.updateTooltip = function(event) {
842
4ae2247a59f4 Changes for Cinecast
veltr
parents: 834
diff changeset
   176
    var _segment = Math.max(0,Math.min(this.groups.length - 1, Math.floor(this.slices * (event.pageX - this.selector.offset().left)/this.width))),
661
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   177
        _valeurs = this.groups[_segment],
842
4ae2247a59f4 Changes for Cinecast
veltr
parents: 834
diff changeset
   178
        _width = this.width / this.slices,
4ae2247a59f4 Changes for Cinecast
veltr
parents: 834
diff changeset
   179
        _html = '<ul style="list-style: none; margin: 0; padding: 0;">' + IriSP._(this.tags).map(function(_tag, _i) {
661
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   180
            return '<li style="clear: both;"><span style="float: left; width: 10px; height: 10px; margin: 2px; background: '
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   181
                + _tag.color
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   182
                + ';"></span>'
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   183
                + ~~(100 * _valeurs[_i])
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   184
                + '% de '
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   185
                + _tag.description
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   186
                + '</li>';
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   187
        }).join('') + '</ul>';
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   188
    this.TooltipWidget._shown = false; // Vraiment, on ne peut pas ouvrir le widget s'il n'est pas encore ouvert ?
842
4ae2247a59f4 Changes for Cinecast
veltr
parents: 834
diff changeset
   189
    this.TooltipWidget.show('','',(_segment + .5)* this.width / this.slices, 0);
661
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   190
    this.TooltipWidget.selector.find(".tip").html(_html);
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   191
    this.rectangleFocus.attr({
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   192
        "x" : _segment * _width,
766
aa26ddaf2556 fixed raphael's files to remove trailing colon at the end of objects to make
hamidouk
parents: 694
diff changeset
   193
        "opacity" : .4
661
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   194
    })
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   195
}
48c1beea7b1c change line endings to unix.
hamidouk
parents: 657
diff changeset
   196