# HG changeset patch # User hamidouk # Date 1328781707 -3600 # Node ID 9d2b6f31994d39c4dbefd7e7bd075e95a5d4de44 # Parent 15c32b49de59c789d7cb1779a0aaff7aa5fe9d77 update the graph correctly. diff -r 15c32b49de59 -r 9d2b6f31994d src/js/widgets/sparklineWidget.js --- a/src/js/widgets/sparklineWidget.js Thu Feb 09 10:30:49 2012 +0100 +++ b/src/js/widgets/sparklineWidget.js Thu Feb 09 11:01:47 2012 +0100 @@ -124,9 +124,16 @@ var duration = +this._serializer.currentMedia().meta["dc:duration"]; var time_step = Math.round(duration / num_columns); /* the time interval between two columns */ var begin = +annotation.begin; + var end = +annotation.end; - var index = Math.floor(begin / time_step); - this._results[index]++; + /* increment all the values between the beginning and the end of the annotation */ + var index_begin = Math.floor(begin / time_step); + var index_end = Math.floor(end / time_step); + + for (var i = index_begin; i < Math.min(index_end, this._results.length); i++) { + this._results[i]++; + } + this.selector.find(".Ldt-sparkLine").sparkline(this._results, {lineColor: "#7492b4", fillColor: "#aeaeb8", spotColor: "#b70056", width: this.width, height: this.height});