[hamster-applet/2_28_no_bars] put back the factors



commit a5e8c864555261e2114bd78090bf694150932bce
Author: Toms Bauģis <toms baugis gmail com>
Date:   Tue Nov 10 21:22:22 2009 +0000

    put back the factors

 hamster/charting.py |   28 ++++++++++++++++------------
 1 files changed, 16 insertions(+), 12 deletions(-)
---
diff --git a/hamster/charting.py b/hamster/charting.py
index f0f08be..4136514 100644
--- a/hamster/charting.py
+++ b/hamster/charting.py
@@ -334,18 +334,21 @@ class BarChart(Chart):
 
             if self.stack_keys:
                 for j in range(len(self.integrators[i])):
-                    bar_size = max_bar_size * 1
-                    bar_start += bar_size
-                    
-                    self.draw_bar(bar_x,
-                                  self.graph_height - bar_start,
-                                  bar_width - (gap * 2),
-                                  bar_size,
-                                  self.get_bar_color(j))
+                    factor = self.integrators[i][j].value
+    
+                    if factor > 0:
+                        bar_size = max_bar_size * factor
+                        bar_start += bar_size
+                        
+                        self.draw_bar(bar_x,
+                                      self.graph_height - bar_start,
+                                      bar_width - (gap * 2),
+                                      bar_size,
+                                      self.get_bar_color(j))
                     context.stroke()
             else:
-                #factor = self.integrators[i].value
-                bar_size = 15
+                factor = self.integrators[i].value
+                bar_size = max_bar_size * factor
                 bar_start = bar_size
 
                 self.draw_bar(bar_x,
@@ -481,7 +484,7 @@ class HorizontalBarChart(Chart):
             if self.stack_keys:
                 bar_start = 0
                 for j, factor in enumerate(self.integrators[i]):
-                    bar_size = max_bar_size
+                    bar_size = max_bar_size * factor.value
                     bar_height = bar_width - (gap * 2)
                     
                     last_color = self.get_bar_color(j)
@@ -492,7 +495,8 @@ class HorizontalBarChart(Chart):
                                   last_color)
                     bar_start += bar_size
             else:
-                bar_size = max_bar_size
+                factor = self.integrators[i].value
+                bar_size = max_bar_size * factor
                 bar_start = bar_size
 
                 bar_height = bar_width - (gap * 2)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]