Use browser width to scale cpu and bandwidth graphs on device overview

This commit is contained in:
Louis Bailleul
2015-12-02 12:52:08 +00:00
parent 20ec8608c3
commit ee75091c44
2 changed files with 27 additions and 5 deletions

View File

@@ -10,8 +10,17 @@ if ($ports['total']) {
</div> </div>
<table class="table table-hover table-condensed table-striped">'; <table class="table table-hover table-condensed table-striped">';
$graph_array['height'] = '100'; if($_SESSION['screen_width']) {
$graph_array['width'] = '485'; if($_SESSION['screen_width'] > 970) {
$graph_array['width'] = round(($_SESSION['screen_width'] - 190 )/2,0);
$graph_array['height'] = round($graph_array['width'] /3);
}
else {
$graph_array['width'] = $_SESSION['screen_width'] - 110;
$graph_array['height'] = round($graph_array['width'] /3);
}
}
$graph_array['to'] = $config['time']['now']; $graph_array['to'] = $config['time']['now'];
$graph_array['device'] = $device['device_id']; $graph_array['device'] = $device['device_id'];
$graph_array['type'] = 'device_bits'; $graph_array['type'] = 'device_bits';
@@ -19,6 +28,9 @@ if ($ports['total']) {
$graph_array['legend'] = 'no'; $graph_array['legend'] = 'no';
$graph = generate_lazy_graph_tag($graph_array); $graph = generate_lazy_graph_tag($graph_array);
#Generate tooltip
$graph_array['width'] = 210;
$graph_array['height'] = 100;
$link_array = $graph_array; $link_array = $graph_array;
$link_array['page'] = 'graphs'; $link_array['page'] = 'graphs';
unset($link_array['height'], $link_array['width']); unset($link_array['height'], $link_array['width']);

View File

@@ -64,9 +64,18 @@ if (count($processors)) {
if ($config['cpu_details_overview'] === false) if ($config['cpu_details_overview'] === false)
{ {
if($_SESSION['screen_width']) {
if($_SESSION['screen_width'] > 970) {
$graph_array['width'] = round(($_SESSION['screen_width'] - 190 )/2,0);
$graph_array['height'] = round($graph_array['width'] /3);
}
else {
$graph_array['width'] = $_SESSION['screen_width'] - 110;
$graph_array['height'] = round($graph_array['width'] /3);
}
}
//Generate average cpu graph //Generate average cpu graph
$graph_array['height'] = '100';
$graph_array['width'] = '485';
$graph_array['device'] = $device['device_id']; $graph_array['device'] = $device['device_id'];
$graph_array['type'] = 'device_processor'; $graph_array['type'] = 'device_processor';
$graph = generate_lazy_graph_tag($graph_array); $graph = generate_lazy_graph_tag($graph_array);
@@ -78,7 +87,8 @@ if (count($processors)) {
$link = generate_url($link_array); $link = generate_url($link_array);
//Generate tooltip //Generate tooltip
$graph_array['width'] = '210'; $graph_array['width']=210;
$graph_array['height']=100;
$overlib_content = generate_overlib_content($graph_array, $device['hostname'].' - CPU usage'); $overlib_content = generate_overlib_content($graph_array, $device['hostname'].' - CPU usage');
echo '<tr> echo '<tr>