This way we can define a listener when needed to react to any clicks in the legend. Usually enabling/disabling some data series.
The event was nowhere documented, but by using the following snippet, right where we add the listener, it can be observed to happen. ``` Ext.mixin.Observable.capture(this, function(evname) {console.log(evname, arguments);}) ``` This would be `me.legend` in that scenario. Signed-off-by: Aaron Lauterer <a.laute...@proxmox.com> --- src/panel/RRDChart.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/panel/RRDChart.js b/src/panel/RRDChart.js index 7f0b923..c81e2e7 100644 --- a/src/panel/RRDChart.js +++ b/src/panel/RRDChart.js @@ -67,6 +67,8 @@ Ext.define('Proxmox.widget.RRDChart', { // set to empty string to suppress warning in debug mode downloadServerUrl: '-', + onLegendChange: Ext.emptyFn, // empty dummy function so we can add listener for legend events when needed + controller: { xclass: 'Ext.app.ViewController', @@ -261,6 +263,8 @@ Ext.define('Proxmox.widget.RRDChart', { me.updateHeader(); if (me.header && me.legend) { + // event itemclick is not documented for legend, but found it by printing all events happening + me.legend.addListener('itemclick', me.onLegendChange); me.header.padding = '4 9 4'; me.header.add(me.legend); me.legend = undefined; -- 2.39.5 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel