class CWidgetPieChart extends CWidget {
static ZBX_STYLE_DASHBOARD_WIDGET_PADDING_V = 8;
static ZBX_STYLE_DASHBOARD_WIDGET_PADDING_H = 10;
static ZBX_STYLE_PIE_CHART_LEGEND = 'svg-pie-chart-legend';
static ZBX_STYLE_PIE_CHART_LEGEND_HEADER = 'svg-pie-chart-legend-header';
static ZBX_STYLE_PIE_CHART_LEGEND_ITEM = 'svg-pie-chart-legend-item';
static ZBX_STYLE_PIE_CHART_LEGEND_SHOW_VALUE = 'svg-pie-chart-legend-show-value';
static ZBX_STYLE_PIE_CHART_LEGEND_VALUE = 'svg-pie-chart-legend-value';
static ZBX_STYLE_PIE_CHART_LEGEND_NO_DATA = 'svg-pie-chart-legend-no-data';
static DATASET_TYPE_SINGLE_ITEM = 0;
static LEGEND_LINE_HEIGHT = 18;
static LEGEND_LINES_MODE_VARIABLE = 1;
if (this.getState() === WIDGET_STATE_ACTIVE && this.#pie_chart !== null) {
this.#pie_chart.setSize(this.#getSize());
const readiness = [super.promiseReady()];
if (this.#pie_chart !== null) {
readiness.push(this.#pie_chart.promiseRendered());
return Promise.all(readiness);
const request_data = super.getUpdateRequestData();
for (const [dataset_key, dataset] of request_data.fields.ds.entries()) {
if (dataset.dataset_type != CWidgetPieChart.DATASET_TYPE_SINGLE_ITEM) {
for (const [item_index, itemid] of dataset.itemids.entries()) {
if (Array.isArray(itemid)) {
if (itemid.length === 1) {
dataset_new.itemids.push(itemid[0]);
dataset_new.type.push(dataset.type[item_index]);
dataset_new.color.push(dataset.color[item_index]);
dataset_new.itemids.push(itemid);
dataset_new.type.push(dataset.type[item_index]);
dataset_new.color.push(dataset.color[item_index]);
request_data.fields.ds[dataset_key] = dataset_new;
if (!this.getFieldsReferredData().has('time_period')) {
request_data.has_custom_time_period = 1;