+ if (isset($gconf['special']) && count($gconf['special'])) {
+ foreach ($gconf['special'] as $crow) {
+ $srow = array();
+ $srow['sType'] = isset($crow['sType'])?$crow['sType']:'COMMENT';
+ if ($grow['sType'] != 'COMMENT') {
+ // XXX: use line below and remove cf var once we have rrdtol 1.2
+ // $srow['name'] = $crow['name'].(isset($crow['cf'])?'_'.$crow['cf']:'');
+ $srow['name'] = $crow['name'];
+ $srow['cf'] = isset($crow['cf'])?$crow['cf']:'AVERAGE';
+ if (isset($crow['cf'])) {
+ // XXX: use line below once we have rrdtol 1.2
+ // $graphrows[] = array('dType'=>'VDEF', 'name'=>$srow['name'].'_'.$crow['cf'], 'rpn_expr'=>$srow['name'].','.$crow['cf']);
+ }
+ elseif (isset($crow['rpn_expr'])) {
+ // XXX: does only work with rrdtool 1.2
+ $graphrows[] = array('dType'=>'VDEF', 'name'=>$srow['name'], 'rpn_expr'=>$crow['rpn_expr']);
+ }
+ }
+ $srow['text'] = isset($crow['text'])?$crow['text']:'';
+ $specialrows[] = $srow;
+ }
+ }
+ else {
+ foreach ($graphrows as $grow) {
+ if (isset($grow['gType']) && strlen($grow['gType'])) {
+ $textprefix = isset($grow['legend'])?$grow['legend']:$grow['name'];
+ // XXX: use lines below once we have rrdtol 1.2
+ // $graphrows[] = array('dType'=>'VDEF', 'name'=>$grow['name'].'_last', 'rpn_expr'=>$grow['name'].',LAST');
+ // $specialrows[] = array('sType'=>'PRINT', 'name'=>$grow['name'].'_last', 'text'=>'%3.2lf%s');
+ $specialrows[] = array('sType'=>'PRINT', 'name'=>$grow['name'], 'cf'=>'MAX', 'text'=>$textprefix.'|Maximum|%.2lf%s');
+ $specialrows[] = array('sType'=>'PRINT', 'name'=>$grow['name'], 'cf'=>'AVERAGE', 'text'=>$textprefix.'|Average|%.2lf%s');
+ $specialrows[] = array('sType'=>'PRINT', 'name'=>$grow['name'], 'cf'=>'LAST', 'text'=>$textprefix.'|Current|%.2lf%s');
+ }
+ }
+ }
+
+ $endtime = isset($gconf['time_end'])?$gconf['time_end']:(is_numeric($this->last_update())?$this->last_update():time());
+ $gOpts = ' --start '.($endtime-$duration).' --end '.$endtime.' --step '.$slice;
+ if (isset($gconf['label_top'])) { $gOpts .= ' --title '.$this->text_quote($gconf['label_top']); }
+ if (isset($gconf['label_y'])) { $gOpts .= ' --vertical-label '.$this->text_quote($gconf['label_y']); }
+ if (isset($gconf['width'])) { $gOpts .= ' --width '.$gconf['width']; }
+ if (isset($gconf['height'])) { $gOpts .= ' --height '.$gconf['height'];
+ if (($gconf['height'] <= 32) && isset($gconf['thumb']) && ($gconf['thumb'])) { $gOpts .= ' --only-graph'; }
+ }
+ if (!isset($gconf['show_legend']) || (!$gconf['show_legend'])) { $gOpts .= ' --no-legend'; }
+ if (isset($gconf['min_y'])) { $gOpts .= ' --lower-limit '.$gconf['min_y']; }
+ if (isset($gconf['max_y'])) { $gOpts .= ' --upper-limit '.$gconf['max_y']; }
+ if (isset($gconf['fix_scale_y']) && $gconf['fix_scale_y']) { $gOpts .= ' --rigid'; }
+ if (isset($gconf['grid_x'])) { $gOpts .= ' --x-grid '.$gconf['grid_x']; }
+ if (isset($gconf['grid_y'])) { $gOpts .= ' --y-grid '.$gconf['grid_y']; }
+ 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 (isset($gconf['force_color']) && is_array($gconf['force_color'])) {
+ foreach ($gconf['force_color'] as $ctag=>$cval) { $gOpts .= ' --color '.$ctag.$cval; }
+ }
+ if (isset($gconf['force_font']) && is_array($gconf['force_font'])) {
+ foreach ($gconf['force_font'] as $ctag=>$cval) { $gOpts .= ' --font '.$ctag.$cval; }
+ }
+ if (isset($gconf['units_binary']) && $gconf['units_binary']) { $gOpts .= ' --base 1024'; }
+