Only apply SVG responsiveness when not rendered in compact mode

Don't let SVGs grow vertically in when displayed in the dashboard, to avoid wasted space
This commit is contained in:
Matthias Jentsch 2014-08-28 16:52:02 +02:00
parent 648debff88
commit e799d65d3f
4 changed files with 23 additions and 12 deletions

View File

@ -22,6 +22,11 @@ use Icinga\Chart\Unit\StaticAxis;
class Monitoring_ChartController extends Controller class Monitoring_ChartController extends Controller
{ {
public function init()
{
$this->view->compact = $this->_request->getParam('view') === 'compact';
}
public function testAction() public function testAction()
{ {
$this->chart = new GridChart(); $this->chart = new GridChart();

View File

@ -1,6 +1,9 @@
<div class="chart"> <?php if (! $this->compact) { ?>
<?= <div class="svg-container-responsive">
$chart->render(); <?= $chart->render(); ?>
?> <?= isset($chart2) ? $chart2->render() : ''; ?>
</div> </div>
<?php } else { ?>
<?= $chart->render(); ?>
<?php } ?>

View File

@ -1,6 +1,8 @@
<div class="chart"> <?php if (! $this->compact) { ?>
<?= <div class="svg-container-responsive">
$chart->render(); <?= $chart->render(); ?>
?> </div>
</div> <?php } else { ?>
<?= $chart->render(); ?>
<?php } ?>

View File

@ -175,6 +175,7 @@ ul.tree li a.error:hover {
} }
/* charts should grow as much as possible but never beyond the current viewport's size */ /* charts should grow as much as possible but never beyond the current viewport's size */
div.chart { .svg-container-responsive {
height: 90vh; padding: 1.5em;
height: 80vh;
} }