Source
* Get array of X points with labels, for grid and X/Y axes. Array key is Y coordinate for SVG, value is label with
<?php declare(strict_types = 0);
/*
** 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/>.
**/
class CSvgGraph extends CSvg {
public const SVG_GRAPH_X_AXIS_HEIGHT = 20;
public const SVG_GRAPH_DEFAULT_COLOR = '#b0af07';
public const SVG_GRAPH_DEFAULT_TRANSPARENCY = 5;
public const SVG_GRAPH_DEFAULT_POINTSIZE = 1;
public const SVG_GRAPH_DEFAULT_LINE_WIDTH = 1;
public const SVG_GRAPH_X_AXIS_LABEL_MARGIN = 5;
public const SVG_GRAPH_Y_AXIS_LABEL_MARGIN_OUTER = 10;
public const SVG_GRAPH_Y_AXIS_LABEL_MARGIN_INNER = 5;
private $canvas_x;
private $canvas_y;
private $canvas_width;
private $canvas_height;
private $graph_theme;
/**
* Graph metrics.
*
* @var array
*/
private array $metrics = [];
/**
* Original graph points, calculated from metrics.
*
* @var array
*/
private array $points = [];
/**
* Graph points for stacked lines and stacked staircases, calculated from metrics and original graph points.
*
* @var array
*/
private array $stacked_points = [];
/**
* Bar points for stacked and unstacked bars, calculated from metrics and original graph points.
*
* @var array
*/
private array $bar_points = [];