/openshift/adei

To get this branch, use:
bzr branch http://darksoft.org/webbzr/openshift/adei

« back to all changes in this revision

Viewing changes to classes/draw.php

  • Committer: Suren A. Chilingaryan
  • Date: 2021-07-15 15:23:07 UTC
  • Revision ID: csa@suren.me-20210715152307-otk9cxx0g0ro03vd
Support different modes of assigning axes to the channels

Show diffs side-by-side

added added

removed removed

Lines of Context:
192
192
 var $precision;                // Actual graph precision in pixels
193
193
 
194
194
 var $plot_mode;                // Plotting mode (standard ADEI mode or Munin mode)
 
195
 var $axes_mode;
195
196
 
196
197
 var $hide_axes;                // Flag indicating what axes should be hiden
197
198
 
211
212
 
212
213
 const PLOT_STANDARD = 0;
213
214
 const PLOT_CUSTOM = 1;
 
215
 const AXES_STANDARD = 0;
 
216
 const AXES_SINGLE = 1;
 
217
 const AXES_INDIVIDUAL = 2;
214
218
 
215
219
 const MIN_LOG = 1e-10;
216
220
 
309
313
 
310
314
    throw new ADEIException(translate("Unsupported plotting mode (%s) is specified", $mode));
311
315
 }
 
316
 
 
317
 static function FindAxesMode($mode) {
 
318
    $name = "DRAW::AXES_" . strtoupper($mode);
 
319
    if (defined($name)) return constant($name);
 
320
    else if ((!$mode)||(($mode<0)&&($mode>=DRAW::AXES_INDIVIDUAL))||($mode>0)) return $mode;
 
321
 
 
322
    throw new ADEIException(translate("Unsupported axis mode (%s) is specified", $mode));
 
323
 }
 
324
 
 
325
 
312
326
 
313
327
 function GetTmpFile() {
314
328
    global $GRAPH_LOWPRECISION_UPDATE_RATE;
474
488
    $time_on_addon = false;
475
489
 
476
490
        // Disable Axes is above limit to save space
477
 
    for ($i=0;$i<$size;$i++) {
478
 
        $axislist[$i] = is_array($itemlist[$i])?$itemlist[$i]['axis']:false;
 
491
    
 
492
    $this->axes_mode = $this->FindAxesMode($this->req->props['axes_mode']);
 
493
    if (intval($this->axes_mode) == DRAW::AXES_INDIVIDUAL) {
 
494
        for ($i=0;$i<$size;$i++) {
 
495
            $axislist[$i] = $itemlist[$i]['uid']?$itemlist[$i]['uid']:'axis' . $cachewrap->cache->GetGroupPostfix() . "__" . $itemlist[$i]['id'];
 
496
        }
 
497
    } elseif (intval($this->axes_mode) == DRAW::AXES_SINGLE) {
 
498
        for ($i=0;$i<$size;$i++) {
 
499
            $axislist[$i] = false;
 
500
        }
 
501
    
 
502
    } else  { // if ($this->axes_mode == DRAW::AXES_STANDARD) {
 
503
        for ($i=0;$i<$size;$i++) {
 
504
            $axislist[$i] = is_array($itemlist[$i])?$itemlist[$i]['axis']:false;
 
505
        }
479
506
    }
480
507
 
481
508
    if (($GRAPH_MAX_AXES)&&(sizeof(array_unique($axislist)) > $GRAPH_MAX_AXES)) {
490
517
        $empty[$i] = true;
491
518
//      $axislist[$i] = is_array($itemlist[$i])?$itemlist[$i]['axis']:false;
492
519
        $axis = $axes->GetAxis($axislist[$i]);
 
520
        if (intval($this->axes_mode) == DRAW::AXES_INDIVIDUAL) {
 
521
            $axis->title = $itemlist[$i]['name'];
 
522
        }
 
523
 
493
524
        $range = $axis->GetRange();
494
525
        $log_scale[$i] = $axis->IsLogarithmic();
495
526