diff --git a/html/includes/graphs/device/collectd.inc.php b/html/includes/graphs/device/collectd.inc.php index 4a99662ab..e0b748d6f 100755 --- a/html/includes/graphs/device/collectd.inc.php +++ b/html/includes/graphs/device/collectd.inc.php @@ -204,7 +204,7 @@ if(isset($rrd_cmd)) $rrd_cmd .= " -s " . $from . " -e " . $to; } -if ($_GET['legend'] == "no" || $_GET['legend'] == 0) { $rrd_cmd .= " -g "; } +if ($_GET['legend'] == "no") { $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'] . " "; } diff --git a/html/pages/graphs.inc.php b/html/pages/graphs.inc.php index efb70dfc0..a8b2d06b8 100644 --- a/html/pages/graphs.inc.php +++ b/html/pages/graphs.inc.php @@ -36,18 +36,20 @@ if (!$auth) $graph_array = $vars; $graph_array['height'] = "60"; $graph_array['width'] = $thumb_width; - $graph_array['legend'] = 0; + $graph_array['legend'] = "no"; $graph_array['to'] = $now; print_optionbar_start(); echo($title); print_optionbar_end(); - echo('
'); + print_optionbar_start(); $thumb_array = array('sixhour' => '6 Hours', 'day' => '24 Hours', 'twoday' => '48 Hours', 'week' => 'One Week', 'twoweek' => 'Two Weeks', 'month' => 'One Month', 'twomonth' => 'Two Months','year' => 'One Year', 'twoyear' => 'Two Years'); + echo(''); + foreach ($thumb_array as $period => $text) { $graph_array['from'] = $config['time'][$period]; @@ -58,20 +60,33 @@ if (!$auth) $link_array['page'] = "graphs"; $link = generate_url($link_array); - echo('
- '.$text.'
- '); + echo('
'); + } - echo(""); + + echo('
'); + echo(''.$text.'
'); + echo(''); echo(generate_graph_tag($graph_array)); - echo(" - "); + echo(''); + echo('
'); $graph_array = $vars; - $graph_array['height'] = "300"; $graph_array['width'] = $graph_width; + echo("
"); + + if($vars['legend'] == "no") + { + echo(generate_link("Show Legend",$vars, array('page' => "graphs", 'legend' => NULL))); + } else { + echo(generate_link("Hide Legend",$vars, array('page' => "graphs", 'legend' => "no"))); + } + + print_optionbar_end(); + + echo generate_graph_js_state($graph_array); echo('
');