Ejemplo n.º 1
0
 function __construct(DATARequest $props = NULL)
 {
     global $GRAPH_INTERPOLATE_DATA_GAPS;
     global $GRAPH_ACCURACY_MARKS_IF_GAPS;
     global $GRAPH_INDICATE_MISSING_DATA;
     global $GRAPH_INDICATE_DATA_DENSITY;
     if ($props) {
         parent::__construct($props);
     } else {
         parent::__construct(new DATARequest());
     }
     if ($this->width < 32 || $this->height < 32) {
         throw new ADEIException(translate("The graph dimmensions (%ux%u) are too small, use at least 32x32", $this->width, $this->height));
     }
     /*  DS, ToDo: We should restore some variables before we can reuse files 
         if (is_file($TMP_PATH . "/" .  $this->tmpfile)) $this->ready = true;
         else */
     $this->reader = $this->req->CreateReader();
     $opts = $this->req->GetOptions();
     $this->use_cache_timewindow = $opts->Get('use_cache_timewindow');
     $this->time_limit = $opts->GetDateLimit();
     $this->set_time_axes = !$opts->Get('optimize_time_axes');
     if (isset($this->req->props['precision'])) {
         $this->precision_mode = $this->FindPrecisionMode($this->req->props['precision']);
     } else {
         $this->precision_mode = 0;
     }
     if (isset($this->req->props['aggregation'])) {
         $this->aggregator = CACHE::FindAggregator($this->req->props['aggregation']);
     } else {
         $this->aggregator = CACHE::TYPE_AUTO;
     }
     if (isset($this->req->props['show_marks'])) {
         $this->show_marks = $this->FindMarksMode($this->req->props['show_marks']);
     } else {
         if ($GRAPH_ACCURACY_MARKS_IF_GAPS) {
             $this->show_marks = DRAW::MARKS_GAPS;
         } else {
             $this->show_marks = DRAW::MARKS_DEFAULT;
         }
     }
     if (isset($this->req->props['show_gaps'])) {
         $this->show_gaps = $this->FindGapsMode($this->req->props['show_gaps']);
     } else {
         if ($GRAPH_INDICATE_DATA_DENSITY) {
             eval("\$this->show_gaps = DRAW::{$GRAPH_INDICATE_DATA_DENSITY};");
         } else {
             $this->show_gaps = $GRAPH_INDICATE_DATA_DENSITY;
         }
     }
     if (isset($this->req->props['interpolate'])) {
         $this->interpolate_gaps = $this->req->props['interpolate'];
     } else {
         $this->interpolate_gaps = $opts->Get('graph_interpolate', $GRAPH_INTERPOLATE_DATA_GAPS);
     }
     $this->allowed_gap = $opts->Get('maximal_allowed_gap', false);
     $this->hide_axes = $this->req->GetProp('hide_axes', false);
 }