From e955c7d36c794056fd777398ac37c466cde8ddc3 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Tue, 20 Mar 2018 11:52:06 +0100 Subject: web-scripts/statistics.php: make legend nice(r) again --- web-scripts/statistics.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/web-scripts/statistics.php b/web-scripts/statistics.php index 1e4d89b..41b205f 100644 --- a/web-scripts/statistics.php +++ b/web-scripts/statistics.php @@ -51,7 +51,7 @@ $width = 1600; $height = 600; $border = 5; $legend_line_length = 10; -$legend_height = 3 * ImageFontHeight(5) + $legend_line_length; +$legend_height = 4 * ImageFontHeight(5) + $legend_line_length; $im = @ImageCreate ($width + $legend_line_length + $max_len * ImageFontWidth(5), $height + $legend_height) or die ("Cannot create new gd-image-stream"); @@ -118,13 +118,13 @@ function print_graph($data, $color) { ImageRectangle($im, $legend_line_length, 0, $width-1+$legend_line_length, $height-1, $foreground_color); -ImageString($im, 5, $legend_line_length, $height + $legend_line_length + 2*ImageFontHeight(5), "( ".trim(shell_exec("uptime | sed 's|^.*\\s\\(load\\)|\\1|'"))." )", $foreground_color); +ImageString($im, 5, $legend_line_length, $height + 2*$legend_line_length + 2*ImageFontHeight(5), "( ".trim(shell_exec("uptime | sed 's|^.*\\s\\(load\\)|\\1|'"))." )", $foreground_color); $xpos = $legend_line_length; foreach ($print_columns as $column) { print_graph($values[$column], $colors[$column]); - ImageString($im, 5, $xpos, $height + $legend_line_length + ImageFontHeight(5), $column, $colors[$column]); - $xpos += (strlen($column) + 1.75) * ImageFontWidth(5); + ImageString($im, 5, $xpos, $height + $legend_line_length + ImageFontHeight(5), substr($column,0,-strlen("_count")), $colors[$column]); + $xpos += (strlen($column) - strlen("_count") + 1.75) * ImageFontWidth(5); } ImageString($im, 5, $legend_line_length, $height + $legend_line_length, date('Y-m-d H:i', $t_min), $foreground_color); -- cgit v1.2.3-70-g09d2