Piecharts: Remove trailing whitespace from slice labels
authorJohn Darrington <john@darrington.wattle.id.au>
Mon, 19 Jan 2015 15:01:06 +0000 (16:01 +0100)
committerJohn Darrington <john@darrington.wattle.id.au>
Mon, 19 Jan 2015 15:01:06 +0000 (16:01 +0100)
src/output/charts/piechart.c

index aac8bfbf8d03429517987e4c52e4d03f7f4d85cf..366e729e7cd16b4811dbbcb42b0a76f9578f7fb2 100644 (file)
@@ -43,6 +43,11 @@ piechart_create (const char *title, const struct slice *slices, int n_slices)
       struct slice *dst = &pie->slices[i];
 
       ds_init_string (&dst->label, &src->label);
+
+      /* Chomp any whitespace from the RHS of the label.
+        Doing this ensures that those labels to the right
+        of the pie, appear right justified. */
+      ds_rtrim (&dst->label, ss_cstr (" \t"));
       dst->magnitude = src->magnitude;
     }
   pie->n_slices = n_slices;