From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 2DEF61FF15C for ; Fri, 19 Sep 2025 10:04:16 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 3FC04FE22; Fri, 19 Sep 2025 10:04:31 +0200 (CEST) From: Dominik Csapak To: pve-devel@lists.proxmox.com, pmg-devel@lists.proxmox.com Date: Fri, 19 Sep 2025 10:03:47 +0200 Message-ID: <20250919080358.745214-1-d.csapak@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.027 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pmg-devel] [PATCH widget-toolkit] RRDChart: fix customizing axes in a subclass X-BeenThere: pmg-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Mail Gateway development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pmg-devel-bounces@lists.proxmox.com Sender: "pmg-devel" the introduction of the NumericBase2 segmenter in commit 9531c65 (rrd chart: fix y-axis segmentation when using powerOfTwo) changed the way the axes are defined and created. The commit message noted that we can't override the axes config anymore but that we did not use that. It actually was used in the PMG dashboard with the 'MiniGraph' subclass. Luckily the configs were similar enough so that it did not matter much, so nobody seemed to notice. On recent examination of the charts, the labels of the axes were overlapping each other in certain conditions, and then it became apparent that the customization there for the axis did not apply anymore. To fix it, move the axes definition back to the class config, and overwrite the segmenter on each left or right 'numeric' axis if necessary. By overwriting it in 'config.axes' (and me.config.axes as fallback) we're able to use: * a default config (from the class definition, lands in `me.config`) * a subclass override (lands also in `me.config`) * overrides on actual creation (lands in `config`) I examined if we can override/set this config later e.g. in the initComponent, since a manual override + class config would be merged there, but it seems that the chart initializes the axes already before the initComponent. Using 'setSegmenter' later on is also not possible really, because for some reason this only changes the top-most point in the axis labels, but not the intermediate ones. Signed-off-by: Dominik Csapak --- src/panel/RRDChart.js | 42 ++++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/src/panel/RRDChart.js b/src/panel/RRDChart.js index 148015c..82615ce 100644 --- a/src/panel/RRDChart.js +++ b/src/panel/RRDChart.js @@ -173,6 +173,21 @@ Ext.define('Proxmox.widget.RRDChart', { padding: 0, style: 'cursor: pointer;', }, + axes: [ + { + type: 'numeric', + position: 'left', + grid: true, + renderer: 'leftAxisRenderer', + minimum: 0, + }, + { + type: 'time', + position: 'bottom', + grid: true, + fields: ['time'], + }, + ], listeners: { redraw: { fn: 'onAfterAnimation', @@ -191,22 +206,17 @@ Ext.define('Proxmox.widget.RRDChart', { let me = this; let segmenter = config.powerOfTwo ? 'numericBase2' : 'numeric'; - config.axes = [ - { - type: 'numeric', - position: 'left', - grid: true, - renderer: 'leftAxisRenderer', - minimum: 0, - segmenter, - }, - { - type: 'time', - position: 'bottom', - grid: true, - fields: ['time'], - }, - ]; + + let axes = config.axes ?? me.config.axes ?? []; + for (const axis of axes) { + if ( + axis.type === 'numeric' && + (axis.position === 'left' || axis.position === 'right') + ) { + axis.segmenter = segmenter; + } + } + me.callParent([config]); }, -- 2.47.3 _______________________________________________ pmg-devel mailing list pmg-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel