*
* The Initial Developer of the Original Code is
* KaiRo - Robert Kaiser.
- * Portions created by the Initial Developer are Copyright (C) 2005
+ * Portions created by the Initial Developer are Copyright (C) 2005-2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Robert Kaiser <kairo@kairo.at>
if (isset($grow['gType']) && strlen($grow['gType'])) {
$textprefix = isset($grow['desc'])?$grow['desc']:(isset($grow['legend'])?$grow['legend']:$grow['name']);
if ($this->rrd_version() >= '1.2') {
- $graphrows[] = array('dType'=>'VDEF', 'name'=>$grow['name'].'_max', 'rpn_expr'=>$grow['name'].',MAXIMUM');
- $specialrows[] = array('sType'=>'PRINT', 'name'=>$grow['name'].'_max', 'text'=>$textprefix.'|'.dgettext($td, 'Maximum').'|%.2lf%s');
- $graphrows[] = array('dType'=>'VDEF', 'name'=>$grow['name'].'_avg', 'rpn_expr'=>$grow['name'].',AVERAGE');
- $specialrows[] = array('sType'=>'PRINT', 'name'=>$grow['name'].'_avg', 'text'=>$textprefix.'|'.dgettext($td, 'Average').'|%.2lf%s');
- $graphrows[] = array('dType'=>'VDEF', 'name'=>$grow['name'].'_last', 'rpn_expr'=>$grow['name'].',LAST');
- $specialrows[] = array('sType'=>'PRINT', 'name'=>$grow['name'].'_last', 'text'=>$textprefix.'|'.dgettext($td, 'Current').'|%.2lf%s');
+ $graphrows[] = array('dType'=>'VDEF', 'name'=>'_'.$grow['name'].'__max', 'rpn_expr'=>$grow['name'].',MAXIMUM');
+ $specialrows[] = array('sType'=>'PRINT', 'name'=>'_'.$grow['name'].'__max', 'text'=>$textprefix.'|'.dgettext($td, 'Maximum').'|%.2lf%s');
+ $graphrows[] = array('dType'=>'VDEF', 'name'=>'_'.$grow['name'].'__avg', 'rpn_expr'=>$grow['name'].',AVERAGE');
+ $specialrows[] = array('sType'=>'PRINT', 'name'=>'_'.$grow['name'].'__avg', 'text'=>$textprefix.'|'.dgettext($td, 'Average').'|%.2lf%s');
+ $graphrows[] = array('dType'=>'VDEF', 'name'=>'_'.$grow['name'].'__last', 'rpn_expr'=>$grow['name'].',LAST');
+ $specialrows[] = array('sType'=>'PRINT', 'name'=>'_'.$grow['name'].'__last', 'text'=>$textprefix.'|'.dgettext($td, 'Current').'|%.2lf%s');
}
else {
$specialrows[] = array('sType'=>'PRINT', 'name'=>$grow['name'], 'cf'=>'MAX', 'text'=>$textprefix.'|'.dgettext($td, 'Maximum').'|%.2lf%s');
if (isset($gconf['calc_max_y']) && $gconf['calc_max_y']) { $gOpts .= ' --alt-autoscale-max'; }
if (isset($gconf['units_exponent'])) { $gOpts .= ' --units-exponent '.$gconf['units_exponent']; }
if (isset($gconf['units_length'])) { $gOpts .= ' --units-length '.$gconf['units_length']; }
- if (!isset($gconf['force_recreate']) || (!$gconf['force_recreate'])) { $gOpts .= ' --lazy'; }
+ if (($this->rrd_version() < '1.2') || !count($specialrows)) {
+ // lazy graphics omit all print reporting in RRDtool 1.2!
+ // --> so don't use them there when we want to print stuff
+ if (!isset($gconf['force_recreate']) || (!$gconf['force_recreate'])) { $gOpts .= ' --lazy'; }
+ }
if (isset($gconf['force_color']) && is_array($gconf['force_color'])) {
foreach ($gconf['force_color'] as $ctag=>$cval) { $gOpts .= ' --color '.$ctag.$cval; }
}
// debug output
$gmeta['ret'] = $ret;
}
-// if (preg_match('/\ncommand:(.*?)\n\n/', $ret, $regs)) { $gmeta['graph_cmd'] = $regs[1]; $ret = str_replace($regs[0], "\n",$ret); }
-// else { $gmeta['graph_cmd'] = null; }
$grout = explode("\n", $ret);
foreach ($grout as $gline) {
if (preg_match('/^command:(.+)$/', $gline, $regs)) {