mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-23 05:44:36 +02:00
Add better axis labels to the alert summary chart
This commit is contained in:
parent
fecd4151d1
commit
a456c0434c
@ -342,7 +342,7 @@ class Monitoring_AlertsummaryController extends Controller
|
|||||||
$gridChart = new GridChart();
|
$gridChart = new GridChart();
|
||||||
|
|
||||||
$gridChart->alignTopLeft();
|
$gridChart->alignTopLeft();
|
||||||
$gridChart->setAxisLabel('', mt('monitoring', 'Notifications'))
|
$gridChart->setAxisLabel($this->createPeriodDescription(), mt('monitoring', 'Notifications'))
|
||||||
->setXAxis(new StaticAxis())
|
->setXAxis(new StaticAxis())
|
||||||
->setYAxis(new LinearUnit(10))
|
->setYAxis(new LinearUnit(10))
|
||||||
->setAxisMin(null, 0);
|
->setAxisMin(null, 0);
|
||||||
@ -470,7 +470,7 @@ class Monitoring_AlertsummaryController extends Controller
|
|||||||
$gridChart = new GridChart();
|
$gridChart = new GridChart();
|
||||||
|
|
||||||
$gridChart->alignTopLeft();
|
$gridChart->alignTopLeft();
|
||||||
$gridChart->setAxisLabel('', mt('monitoring', 'Notifications'))
|
$gridChart->setAxisLabel($this->createPeriodDescription(), mt('monitoring', 'Notifications'))
|
||||||
->setXAxis(new StaticAxis())
|
->setXAxis(new StaticAxis())
|
||||||
->setAxisMin(null, 0)
|
->setAxisMin(null, 0)
|
||||||
->setYAxis(new LinearUnit(10));
|
->setYAxis(new LinearUnit(10));
|
||||||
@ -623,4 +623,28 @@ class Monitoring_AlertsummaryController extends Controller
|
|||||||
|
|
||||||
return $interval;
|
return $interval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a human-readable description of the current interval size
|
||||||
|
*
|
||||||
|
* @return string The description of the current interval size
|
||||||
|
*/
|
||||||
|
private function createPeriodDescription()
|
||||||
|
{
|
||||||
|
$int = $this->getInterval();
|
||||||
|
switch ($int) {
|
||||||
|
case '1d':
|
||||||
|
return t('Hour');
|
||||||
|
break;
|
||||||
|
case '1w';
|
||||||
|
return t('Day');
|
||||||
|
break;
|
||||||
|
case '1m':
|
||||||
|
return t('Day');
|
||||||
|
break;
|
||||||
|
case '1y':
|
||||||
|
return t('Month');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user