From 5f007ed1d92c44371364fbf5b43379fbbe10e3c8 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Mon, 27 Dec 2010 01:11:03 -0500 Subject: [PATCH] Bug - The burndown chart was reserving space for the y-axis labels based on the maximum value in the data. This is wrong. Instead it should have used the maximum *label*. Consider a graph with a maximum value of 99, having a width of 2 characters. The graph labels should go up to 100, not 99, and therefore will take up 3 characters. --- src/burndown.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/burndown.cpp b/src/burndown.cpp index c888d8c9c..d3f45962c 100644 --- a/src/burndown.cpp +++ b/src/burndown.cpp @@ -447,13 +447,14 @@ std::string Chart::render () grid.replace (LOC (graph_height / 2, width - 10), 10, "ss Started"); grid.replace (LOC (graph_height / 2 + 1, width - 10), 10, "pp Pending"); - // Draw y-axis. - for (int i = 0; i < graph_height; ++i) - grid.replace (LOC (i + 1, max_label + 1), 1, "|"); - // Determine y-axis labelling. std::vector labels; yLabels (labels); + max_label = (int) log10 ((double) labels[2]) + 1; + + // Draw y-axis. + for (int i = 0; i < graph_height; ++i) + grid.replace (LOC (i + 1, max_label + 1), 1, "|"); // Draw y-axis labels. char label [12];