- 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.
This commit is contained in:
Paul Beckingham 2010-12-27 01:11:03 -05:00
parent 8d720cacc5
commit 5f007ed1d9

View file

@ -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, width - 10), 10, "ss Started");
grid.replace (LOC (graph_height / 2 + 1, width - 10), 10, "pp Pending"); 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. // Determine y-axis labelling.
std::vector <int> labels; std::vector <int> labels;
yLabels (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. // Draw y-axis labels.
char label [12]; char label [12];