equal
deleted
inserted
replaced
99 |
99 |
100 /** react when a new annotation is added */ |
100 /** react when a new annotation is added */ |
101 IriSP.SparklineWidget.prototype.handleNewAnnotation = function(annotation) { |
101 IriSP.SparklineWidget.prototype.handleNewAnnotation = function(annotation) { |
102 var num_columns = (this.selector.width()) / IriSP.widgetsDefaults["SparklineWidget"].column_width; |
102 var num_columns = (this.selector.width()) / IriSP.widgetsDefaults["SparklineWidget"].column_width; |
103 var duration = +this._serializer.currentMedia().meta["dc:duration"]; |
103 var duration = +this._serializer.currentMedia().meta["dc:duration"]; |
104 var time_step = duration / num_columns; /* the time interval between two columns */ |
104 var time_step = Math.round(duration / num_columns); /* the time interval between two columns */ |
105 var begin = +annotation.begin; |
105 var begin = +annotation.begin; |
106 |
106 |
107 var index = Math.floor(begin / time_step); |
107 var index = Math.floor(begin / time_step); |
108 this._results[index]++; |
108 this._results[index]++; |
109 this.selector.find(".Ldt-sparkLine").sparkline(this._results, {lineColor: "#7492b4", fillColor: "#aeaeb8", |
109 this.selector.find(".Ldt-sparkLine").sparkline(this._results, {lineColor: "#7492b4", fillColor: "#aeaeb8", |