Source
this._max = new_value !== null && !isNaN(new_value) ? Number(new_value) : BAR_GAUGE_BAR_DEFAULT_MAX;
/*
** Zabbix
** Copyright (C) 2001-2021 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** 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 General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
const BAR_GAUGE_BAR_DEFAULT_COLOR = '#000000';
const BAR_GAUGE_BAR_DEFAULT_MIN = 0;
const BAR_GAUGE_BAR_DEFAULT_MAX = 100;
const BAR_GAUGE_BAR_ITEM_WIDTH = 7;
class ZBarGauge extends HTMLElement {
constructor() {
super();
this._refresh_frame = null;
this._fill = BAR_GAUGE_BAR_DEFAULT_COLOR;
this._solid = false;
this._min = 0;
this._max = 100;
this._value = 0;
const shadow = this.attachShadow({mode: 'open'});
this._canvas = document.createElement('canvas');
this._canvas.setAttribute('part', 'bar');
shadow.appendChild(this._canvas);
this.registerEvents();
}
connectedCallback() {
setTimeout(() => {
this._events.update();
});
}
disconnectedCallback() {
this.unregisterEvents();
}
static get observedAttributes() {
return ['fill', 'max', 'min', 'solid', 'value', 'width'];
}
attributeChangedCallback(name, old_value, new_value) {
if (old_value === new_value) {