[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [nyx/master] Graphs could blend into each other
commit f9c968b3209f0e16b327dfce1656ca53007c7584
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date: Sat Dec 5 15:00:49 2015 -0800
Graphs could blend into each other
We picked a static subgraph width that could cause our graphs to blend if the
labels were long (such as '144 kb'). Making the width dynamic based on the
labels.
---
nyx/graph_panel.py | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/nyx/graph_panel.py b/nyx/graph_panel.py
index cf43492..f988125 100644
--- a/nyx/graph_panel.py
+++ b/nyx/graph_panel.py
@@ -571,11 +571,17 @@ class GraphPanel(panel.Panel):
self._draw_accounting_stats(attr)
def _draw_subgraph(self, attr, data, x, color):
- subgraph_columns = attr.subgraph_width - 5
+ # Concering our subgraph colums, the y-axis label can be at most six
+ # characters, with two spaces of padding on either side of the graph.
+ # Starting with the smallest size, then possibly raise it after determing
+ # the y_axis_labels.
+
+ subgraph_columns = attr.subgraph_width - 8
min_bound, max_bound = self._get_graph_bounds(attr, data, subgraph_columns)
x_axis_labels = self._get_x_axis_labels(attr, subgraph_columns)
y_axis_labels = self._get_y_axis_labels(attr, data, min_bound, max_bound)
+ subgraph_columns = max(subgraph_columns, attr.subgraph_width - max([len(label) for label in y_axis_labels.values()]) - 2)
axis_offset = max([len(label) for label in y_axis_labels.values()])
self.addstr(1, x, data.header(attr.subgraph_width), curses.A_BOLD, color)
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits