increase type of output graphs.
This commit is contained in:
@ -135,21 +135,22 @@ class Temperature
|
||||
* output graph.
|
||||
*
|
||||
* @param string $type output graph type
|
||||
* @param int $num output period of graph type
|
||||
* @param string $fpath output image file path
|
||||
*
|
||||
* @return bool false if failure
|
||||
*/
|
||||
public function outputGraph(string $type, string $fpath): bool
|
||||
public function outputGraph(string $type, int $num, string $fpath): bool
|
||||
{
|
||||
static $colors = [
|
||||
'#FF0000', '#00FF00', '#0000FF', '#FFFF00', '#00FFFF', '#FF00FF',
|
||||
'#FF9999', '#99FF99', '#9999FF', '#FFFF99', '#99FFFF', '#FF99FF',
|
||||
];
|
||||
static $types = ['hour', 'day', 'week', 'month', 'year', '3year'];
|
||||
static $types = ['hour', 'day', 'week', 'month', 'year'];
|
||||
if (!in_array($type, $types)) {
|
||||
return false;
|
||||
}
|
||||
$start = '3year' == $type ? '-3year' : '-1'.$type;
|
||||
$start = sprintf('-%u%s', $num, $type);
|
||||
$options = [
|
||||
'--imgformat', 'PNG',
|
||||
'--lower-limit', '10',
|
||||
@ -160,7 +161,7 @@ class Temperature
|
||||
'--height', '200',
|
||||
'--units-exponent', '0',
|
||||
'--vertical-label', "Temperature [\xc2\xb0C]",
|
||||
'--title', 'Server Room Temperature - by '.$type,
|
||||
'--title', 'Server Room Temperature - by '.$num.$type.'(s)',
|
||||
];
|
||||
$idlen = 0;
|
||||
foreach ($this->sensorIds as $key => $id) {
|
||||
|
Reference in New Issue
Block a user