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

[tor-commits] [arm/master] fix: intermediate graph bounds sometimes missing



commit 0a17e8cec7619cd9d9343a48e6d971f3d4d833d9
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Thu May 12 19:14:31 2011 -0700

    fix: intermediate graph bounds sometimes missing
    
    Graph bounds are omitted if they match the max or min bound (since, say,
    showing the second tick up as '0' really doesn't make sense). However, integer
    truncation caused many intermediate ticks to be rounded down to zero, and even
    if visible be inaccurate.
---
 src/cli/graphing/graphPanel.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/cli/graphing/graphPanel.py b/src/cli/graphing/graphPanel.py
index c419119..ecf8c68 100644
--- a/src/cli/graphing/graphPanel.py
+++ b/src/cli/graphing/graphPanel.py
@@ -367,11 +367,11 @@ class GraphPanel(panel.Panel):
           if self.graphHeight % 2 == 0 and i >= (ticks / 2): row -= 1
           
           if primaryMinBound != primaryMaxBound:
-            primaryVal = (primaryMaxBound - primaryMinBound) / (self.graphHeight - 1) * (self.graphHeight - row - 1)
+            primaryVal = (primaryMaxBound - primaryMinBound) * (self.graphHeight - row - 1) / (self.graphHeight - 1)
             if not primaryVal in (primaryMinBound, primaryMaxBound): self.addstr(row + 2, 0, "%4i" % primaryVal, primaryColor)
           
           if secondaryMinBound != secondaryMaxBound:
-            secondaryVal = (secondaryMaxBound - secondaryMinBound) / (self.graphHeight - 1) * (self.graphHeight - row - 1)
+            secondaryVal = (secondaryMaxBound - secondaryMinBound) * (self.graphHeight - row - 1) / (self.graphHeight - 1)
             if not secondaryVal in (secondaryMinBound, secondaryMaxBound): self.addstr(row + 2, graphCol + 5, "%4i" % secondaryVal, secondaryColor)
       
       # creates bar graph (both primary and secondary)



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits