From 28b829b18d6b1fa25677f8eaa619dc7d5f4113ff Mon Sep 17 00:00:00 2001 From: Adam Amstrong Date: Sun, 25 Sep 2011 22:10:03 +0000 Subject: [PATCH] fix collectd graphs on graph browser git-svn-id: http://www.observium.org/svn/observer/trunk@2570 61d68cd4-352d-0410-923a-c4978735b2b8 --- html/includes/graphs/device/collectd.inc.php | 7 +++++++ html/pages/graphs.inc.php | 5 ++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/html/includes/graphs/device/collectd.inc.php b/html/includes/graphs/device/collectd.inc.php index f524691da..4a99662ab 100755 --- a/html/includes/graphs/device/collectd.inc.php +++ b/html/includes/graphs/device/collectd.inc.php @@ -204,6 +204,13 @@ if(isset($rrd_cmd)) $rrd_cmd .= " -s " . $from . " -e " . $to; } +if ($_GET['legend'] == "no" || $_GET['legend'] == 0) { $rrd_cmd .= " -g "; } + +if ($height < "99") { $rrd_cmd .= " --only-graph "; } +if ($width <= "300") { $rrd_cmd .= " --font LEGEND:7:" . $config['mono_font'] . " --font AXIS:6:" . $config['mono_font'] . " "; } +else { $rrd_cmd .= " --font LEGEND:8:" . $config['mono_font'] . " --font AXIS:7:" . $config['mono_font'] . " "; } + + if (isset($_GET['debug'])) { header('Content-Type: text/plain; charset=utf-8'); printf("Would have executed:\n%s\n", $rrd_cmd); diff --git a/html/pages/graphs.inc.php b/html/pages/graphs.inc.php index 351627540..efb70dfc0 100644 --- a/html/pages/graphs.inc.php +++ b/html/pages/graphs.inc.php @@ -33,12 +33,11 @@ if (!$auth) } else { if (isset($config['graph_types'][$type][$subtype]['descr'])) { $title .= " :: ".$config['graph_types'][$type][$subtype]['descr']; } else { $title .= " :: ".$graph_type; } + $graph_array = $vars; $graph_array['height'] = "60"; $graph_array['width'] = $thumb_width; - $graph_array['legend'] = "no"; + $graph_array['legend'] = 0; $graph_array['to'] = $now; - $graph_array['id'] = $vars['id']; - $graph_array['type'] = $vars['type']; print_optionbar_start(); echo($title);