Skip to content

Commit

Permalink
[IM] Fix ordering of RRD elements on graph - fixes #332
Browse files Browse the repository at this point in the history
Also removed caching element as this is handled centrally by Grapher.
  • Loading branch information
barryo committed Sep 16, 2017
1 parent e9850cb commit b1b33e7
Showing 1 changed file with 21 additions and 23 deletions.
44 changes: 21 additions & 23 deletions app/Utils/Grapher/Rrd.php
Original file line number Diff line number Diff line change
Expand Up @@ -350,11 +350,6 @@ public function data(): array {
*/
public function png(): string {

// // does the local file exist and is it less than 5mins old?
if( file_exists($this->getLocalFilename('png')) && ( time() - filemtime($this->localfile) < 300 ) ) {
return $this->getLocalFilename('png');
}

$separated_maxima = ( self::PERIOD_TIME[ $this->graph()->period() ] > 60*60*24*2) ? true : false;

list( $indexIn, $indexOut ) = $this->getIndexKeys();
Expand Down Expand Up @@ -387,28 +382,32 @@ public function png(): string {
'VDEF:avg_out=cdefd,AVERAGE',
];

if( $separated_maxima ) {
$options[] = 'LINE2:cdefb#ff00ff:Peak Traffic In ';
$options[] = 'GPRINT:max_in:\tMax\\:%8.2lf%s\l';
$options[] = 'AREA:cdefd#006600:Peak Traffic Out';
$options[] = 'GPRINT:max_out:\tMax\\:%8.2lf%s\l';
$options[] = 'COMMENT:\s';
}

// $avg_label = $separated_maxima ? 'Avg. ' : '';
$options[] = 'COMMENT:Out';

$options[] = 'AREA:cdefc#00CF00:Average Out';
if( !$separated_maxima ) {
$options[] = 'GPRINT:max_out:\tMax\\:%8.2lf%s';
if( $separated_maxima ) {
$options[] = 'AREA:cdefd#006600:Peak';
$options[] = 'GPRINT:max_out:%8.2lf%s\t';
$options[] = 'AREA:cdefc#00CF00:Avg';
} else {
$options[] = 'AREA:cdefc#00CF00:Max';
$options[] = 'GPRINT:max_out:%8.2lf%s\t';
$options[] = 'COMMENT:Avg';
}
$options[] = 'GPRINT:avg_out:\tAvg\\:%8.2lf%s';
$options[] = 'GPRINT:avg_out:%8.2lf%s';
$options[] = 'GPRINT:last_out:\tCur\\:%8.2lf%s\l';

$options[] = 'LINE1:cdefa#002A97FF:Average In ';
if( !$separated_maxima ) {
$options[] = 'GPRINT:max_in:\tMax\\:%8.2lf%s';
$options[] = 'COMMENT:In ';

if( $separated_maxima ) {
$options[] = 'LINE1:cdefb#ff00ff:Peak';
$options[] = 'GPRINT:max_in:%8.2lf%s\t';
$options[] = 'LINE2:cdefa#002A97FF:Avg';
} else {
$options[] = 'LINE2:cdefa#002A97FF:Max';
$options[] = 'GPRINT:max_in:%8.2lf%s\t';
$options[] = 'COMMENT:Avg';
}
$options[] = 'GPRINT:avg_in:\tAvg\\:%8.2lf%s';
$options[] = 'GPRINT:avg_in:%8.2lf%s';
$options[] = 'GPRINT:last_in:\tCur\\:%8.2lf%s\l';

$options[] = 'COMMENT:\s';
Expand All @@ -422,7 +421,6 @@ public function png(): string {
}



/**
* Accessor method for $array - the data from the MRTG file.
*
Expand Down

0 comments on commit b1b33e7

Please sign in to comment.