Source
private static function adjustAxisDimensions(array $dimensions, array $dimensions_min, int $target): array {
<?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 for converting template screens to template dashboards.
*/
class CTemplateScreenConverter extends CConverter {
/**
* Reference display width for widget position and size calculations.
*/
private const DISPLAY_WIDTH = 1920;
private const DASHBOARD_MAX_COLUMNS = 24;
private const DASHBOARD_MAX_ROWS = 64;
private const WIDGET_MIN_ROWS = 2;
private const WIDGET_MAX_ROWS = 32;
/**
* Widget row height on dashboard.
*/
private const WIDGET_ROW_HEIGHT = 70;
/**
* Average height of screen legend.
*/
private const SCREEN_LEGEND_HEIGHT = 215;
/**
* Legacy screen resource types.
*/
private const SCREEN_RESOURCE_TYPE_GRAPH = 0;
private const SCREEN_RESOURCE_TYPE_SIMPLE_GRAPH = 1;
private const SCREEN_RESOURCE_TYPE_PLAIN_TEXT = 3;
private const SCREEN_RESOURCE_TYPE_CLOCK = 7;
private const SCREEN_RESOURCE_TYPE_URL = 11;
private const SCREEN_RESOURCE_TYPE_LLD_SIMPLE_GRAPH = 19;
private const SCREEN_RESOURCE_TYPE_LLD_GRAPH = 20;
/**
* Convert template screen definition to template dashboard definition.
*
* @param array $screen
*
* @return array
*/
public function convert($screen): array {
$widgets = [];
$screen_items = array_key_exists('screen_items', $screen)