Index: trunk/tools/editor_trends/wikilytics/templates/chart.html |
— | — | @@ -6,7 +6,50 @@ |
7 | 7 | <script src="/static/js/jquery-1.4.4.min.js" type="text/javascript"></script> |
8 | 8 | <script type="text/javascript" src="/static/js/jquery.flot.js"></script> |
9 | 9 | <script type="text/javascript" src="/static/js/jquery.flot.stack.js"></script> |
10 | | - $(document).ready(function() { |
11 | | - // put all your jQuery goodness in here. |
12 | | - }); |
| 10 | + |
| 11 | + <script type="text/javascript"> |
| 12 | + $(document).ready(function() { |
| 13 | + |
| 14 | + |
| 15 | + $.ajax({ |
| 16 | + url: '{{ url }}', |
| 17 | + dataType: 'json', |
| 18 | + data: 'json', |
| 19 | + contentType: 'application/json; charset=utf-8', |
| 20 | + success: function(json){ |
| 21 | + var data = json['data']; |
| 22 | + var options = json['options']; |
| 23 | + var css_id = "#wikilytics"; |
| 24 | + console.log(options); |
| 25 | + $.plot($(css_id), data, options); |
| 26 | + } |
| 27 | + }); |
| 28 | + |
| 29 | + $(function () { |
| 30 | + |
| 31 | + var css_id = "#placeholder2"; |
| 32 | + var data = [ |
| 33 | + {label: 'foo', data: [[1,300], [2,300], [3,300], [4,300], [5,300]]}, |
| 34 | + {label: 'bar', data: [[1,800], [2,600], [3,400], [4,200], [5,0]]}, |
| 35 | + {label: 'baz', data: [[1,100], [2,200], [3,300], [4,400], [5,500]]}, |
| 36 | + ]; |
| 37 | + |
| 38 | + var options = { |
| 39 | + series: {stack: 0, |
| 40 | + lines: {show: false, steps: false }, |
| 41 | + bars: {show: true, barWidth: 0.9, align: 'center',},}, |
| 42 | + xaxis: {ticks: [[1,'One'], [2,'Two'], [3,'Three'], [4,'Four'], [5,'Five']]}, |
| 43 | + }; |
| 44 | + console.log(options); |
| 45 | + $.plot($(css_id), data, options); |
| 46 | + |
| 47 | + }); |
| 48 | + |
| 49 | + }); |
| 50 | + </script> |
| 51 | +{% endblock %} |
| 52 | + |
| 53 | +{% block content %} |
| 54 | +<div id="wikilytics" style="width:1000px;height:400px;"></div> |
| 55 | + |
13 | 56 | {% endblock %} |
\ No newline at end of file |