initialized kettu on gitorious
[kettu:kettu.git] / js / helpers / statistic_helpers.js
1 var StatisticHelpers = {
2   drawGraphs: function() {
3     this.drawPie('torrents_by_status', {
4       'Downloading': ($('.downloading').length - 1),
5       'Seeding': ($('.seeding').length - 1),
6       'Paused': ($('.paused').length - 1)
7     });
8     this.drawLines('up_and_download_stats', {
9       'Upload': $.map(transmission.store.get('up_and_download_rate'), function(item) { return (item.up / 1024); }),
10       'Download': $.map(transmission.store.get('up_and_download_rate'), function(item) { return (item.down / 1024); })
11     });
12   },
13   
14   drawPie: function(id, data) {
15     var bluffGraph = new Bluff.Pie(id, 300);
16     bluffGraph.set_theme({
17       colors: ['#B2DFEE', '#FFEC8B', '#BCEE68'],
18       marker_color: '#aea9a9',
19       font_color: '#555555',
20       background_colors: ['#F8F8F8', '#FFFFFF']
21     });
22     for(label in data) {
23       bluffGraph.data(label, data[label]);      
24     }
25     bluffGraph.draw();    
26   },
27   
28   drawLines: function(id, data) {
29     var bluffGraph = new Bluff.Line(id, 300);
30     bluffGraph.set_theme({
31       colors: ['#B2DFEE', '#FFEC8B', '#BCEE68'],
32       marker_color: '#aea9a9',
33       font_color: '#555555',
34       background_colors: ['#F8F8F8', '#FFFFFF']
35     });
36     for(label in data) {
37       bluffGraph.data(label, data[label]);      
38     }
39     bluffGraph.draw();    
40   }
41 }