better graph browser and fixed collectd graphtype to allow showing of legend

git-svn-id: http://www.observium.org/svn/observer/trunk@2571 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2011-09-25 22:37:26 +00:00
parent 28b829b18d
commit 1deb978ceb
2 changed files with 25 additions and 10 deletions

View File

@@ -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'] . " "; }

View File

@@ -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('<div style="margin: auto;">');
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('<table width=100%><tr>');
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('<div style="margin: 0px 10px 5px 0px; padding:5px; background: #e5e5e5; float: left;" class="rounded-3px">
<span class="device-head">'.$text.'</span><br />
<a href="'.$link.'">');
echo('<td align=center>');
echo('<span class="device-head">'.$text.'</span><br />');
echo('<a href="'.$link.'">');
echo(generate_graph_tag($graph_array));
echo(" </a>
</div>");
echo('</a>');
echo('</td>');
}
echo("</div>");
echo('</tr></table>');
$graph_array = $vars;
$graph_array['height'] = "300";
$graph_array['width'] = $graph_width;
echo("<hr />");
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('<div style="width: '.$graph_array['width'].'; margin: auto;">');