Source
* Recalculate $this->shiftY property for graph according header label visibility settings and visibility of graph
<?php
/*
** Copyright (C) 2001-2025 Zabbix SIA
**
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
**
** This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
** See the GNU Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
abstract class CGraphDraw {
protected $stime;
protected $fullSizeX;
protected $fullSizeY;
protected $m_minY;
protected $m_maxY;
protected $data;
protected $items;
private $header;
protected $from_time;
protected $to_time;
private $colors;
protected $colorsrgb;
protected $im;
protected $period;
protected $sizeX;
protected $sizeY;
protected $shiftXleft;
protected $shiftXright;
protected $num;
protected $type;
protected $drawLegend;
protected $graphtheme;
protected $shiftY;
/**
* Default top padding including header label height and vertical padding.
*/
const DEFAULT_HEADER_PADDING_TOP = 36;
/**
* Default font size for header label text.
*/
const DEFAULT_HEADER_LABEL_FONT_SIZE = 11;
/**
* Default value for top and bottom padding.
*/
const DEFAULT_TOP_BOTTOM_PADDING = 12;
/**
* Header label visibility.
*/
public $draw_header = true;
/**
* Use top and bottom padding for graph image.
*/
public $with_vertical_padding = true;
public function __construct($type = GRAPH_TYPE_NORMAL) {
$this->stime = null;
$this->fullSizeX = null;
$this->fullSizeY = null;
$this->m_minY = null;
$this->m_maxY = null;
$this->data = [];
$this->items = [];
$this->header = null;
$this->from_time = null;
$this->to_time = null;
$this->colors = null;
$this->colorsrgb = null;
$this->im = null;
$this->period = SEC_PER_HOUR;
$this->sizeX = 900; // default graph size X
$this->sizeY = 200; // default graph size Y
$this->shiftXleft = 100;
$this->shiftXright = 50;
$this->num = 0;
$this->type = $type; // graph type
$this->drawLegend = 1;
$this->graphtheme = getUserGraphTheme();
$this->shiftY = 0;
}
/**