Source
'output' => ['itemid', 'hostid', $resolve_macros ? 'name_resolved' : 'name', 'history', 'trends', 'units',
<?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/>.
**/
namespace Widgets\PieChart\Actions;
use API,
CAggFunctionData,
CArrayHelper,
CControllerDashboardWidgetView,
CControllerResponseData,
CItemHelper,
Manager;
use Widgets\PieChart\Includes\{
CWidgetFieldDataSet,
WidgetForm
};
class WidgetView extends CControllerDashboardWidgetView {
private const LEGEND_AGGREGATION_ON = 1;
private const LEGEND_VALUE_ON = 1;
private const MERGE_SECTORS_ON = 1;
private const SHOW_TOTAL_ON = 1;
private const SHOW_UNITS_ON = 1;
private const VALUE_BOLD_ON = 1;
protected function init(): void {
parent::init();
$this->addValidationRules([
'has_custom_time_period' => 'in 1',
'with_config' => 'in 1'
]);
}
protected function doAction(): void {
$pie_chart_options = [
'data_sets' => array_values($this->fields_values['ds']),
'data_source' => $this->fields_values['source'],
'time_period' => [
'time_from' => $this->fields_values['time_period']['from_ts'],
'time_to' => $this->fields_values['time_period']['to_ts']
],
'templateid' => $this->getInput('templateid', ''),
'override_hostid' => $this->fields_values['override_hostid']
? $this->fields_values['override_hostid'][0]
: '',
'merge_sectors' => [
'merge' => $this->fields_values['merge'],