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->alignTopLeft();
|
||||
$gridChart->setAxisLabel('', mt('monitoring', 'Notifications'))
|
||||
$gridChart->setAxisLabel($this->createPeriodDescription(), mt('monitoring', 'Notifications'))
|
||||
->setXAxis(new StaticAxis())
|
||||
->setYAxis(new LinearUnit(10))
|
||||
->setAxisMin(null, 0);
|
||||
|
@ -470,7 +470,7 @@ class Monitoring_AlertsummaryController extends Controller
|
|||
$gridChart = new GridChart();
|
||||
|
||||
$gridChart->alignTopLeft();
|
||||
$gridChart->setAxisLabel('', mt('monitoring', 'Notifications'))
|
||||
$gridChart->setAxisLabel($this->createPeriodDescription(), mt('monitoring', 'Notifications'))
|
||||
->setXAxis(new StaticAxis())
|
||||
->setAxisMin(null, 0)
|
||||
->setYAxis(new LinearUnit(10));
|
||||
|
@ -623,4 +623,28 @@ class Monitoring_AlertsummaryController extends Controller
|
|||
|
||||
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…
Reference in New Issue