--- a/.project Thu Jan 12 18:39:35 2012 +0100
+++ b/.project Fri Jan 13 11:04:54 2012 +0100
@@ -6,13 +6,12 @@
</projects>
<buildSpec>
<buildCommand>
- <name>org.python.pydev.PyDevBuilder</name>
+ <name>com.aptana.ide.core.unifiedBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
- <nature>org.python.pydev.pythonNature</nature>
- <nature>org.python.pydev.django.djangoNature</nature>
+ <nature>com.aptana.projects.webnature</nature>
</natures>
</projectDescription>
--- a/src/ldt/ldt/ldt_utils/templates/front/front_all_contents.html Thu Jan 12 18:39:35 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/templates/front/front_all_contents.html Fri Jan 13 11:04:54 2012 +0100
@@ -8,7 +8,7 @@
{% block js_import %}
{{block.super}}
<script src="{{LDT_MEDIA_PREFIX}}js/jquery.min.js" type="text/javascript"/></script>
-<script src="{{LDT_MEDIA_PREFIX}}js/jquery.sparkline.min.js" type="text/javascript"/></script>
+<script src="{{LDT_MEDIA_PREFIX}}js/raphael.js" type="text/javascript"/></script>
{% endblock %}
{% block css_import %}
@@ -19,18 +19,42 @@
{% block js_declaration %}
{{block.super}}
<script type="text/javascript">
+ var _width = 293,
+ _height = 20;
+ var _medias = [ {% for content in content_list %}
+ {
+ "iri_id" : '{{ content.iri_id }}',
+ "stats" : [{{ content.stat_annotation }}],
+ },{% endfor %}
+ ];
$(document).ready(function () {
- // We draw the annotation volume for each content
- /* Use 'html' instead of an array of values to pass options
- to a sparkline with data in the tag */
- $('.graph_annotation').sparkline('html', {width: '293px',
- height:'20px',
- minSpotColor: false,
- maxSpotColor: false,
- spotColor: false,
- lineWidth: '0px',
- fillColor: '#adadad',
- lineColor: '#adadad'});
+ $('.graph_annotation').each(function(_i) {
+ var _values = _medias[_i].stats,
+ _nb = _values.length,
+ _max = _values.reduce(function(_a,_b) {
+ return Math.max(_a,_b);
+ }, 0),
+ _x = function(_p) {
+ return _p * _width / _nb;
+ },
+ _y = function(_p) {
+ return _height * ( 1 - _p / _max );
+ },
+ _d = _values.map(function(_v,_k) {
+ return ( _k == 0 ?
+ "M" + _x(_k) + " " + _y(_v) :
+ "C" + _x(_k-.5) + " " + _y(_values[_k - 1])
+ + " " + + _x(_k-.5) + " " + _y(_v)
+ + " " + + _x(_k) + " " + _y(_v)
+ ) ;
+ }).join("") + "L" + _width + " " + _height + "L0 " + _height;
+ this.innerHTML = '';
+ var _paper = new Raphael(this,_width,_height);
+ _paper.path(_d).attr({
+ "fill" : "#adadad",
+ "stroke" : "#808080"
+ });
+ });
});
</script>
--- a/src/ldt/ldt/ldt_utils/templates/front/front_search_results.html Thu Jan 12 18:39:35 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/templates/front/front_search_results.html Fri Jan 13 11:04:54 2012 +0100
@@ -19,6 +19,8 @@
{% block body %}
{{block.super}}
<script type="text/javascript">
+ var _width = 340,
+ _height = 25;
var _medias = [ {% for res in results.object_list %}
{
"iri_id" : '{{ res.content.iri_id }}',
@@ -51,10 +53,10 @@
return Math.max(_a,_b);
}, 0),
_x = function(_p) {
- return _p * 340 / _nb;
+ return _p * _width / _nb;
},
_y = function(_p) {
- return 25 * ( 1 - _p / _max );
+ return _height * ( 1 - _p / _max );
},
_d = _values.map(function(_v,_k) {
return ( _k == 0 ?
@@ -63,9 +65,9 @@
+ " " + + _x(_k-.5) + " " + _y(_v)
+ " " + + _x(_k) + " " + _y(_v)
) ;
- }).join("") + "L340 25L0 25";
+ }).join("") + "L" + _width + " " + _height + "L0 " + _height;
this.innerHTML = '';
- var _paper = new Raphael(this,340,25);
+ var _paper = new Raphael(this,_width,_height);
_paper.path(_d).attr({
"fill" : "#adadad",
"stroke" : "none"