rrd charts: add legend to header for better space usage

Docking the legend to the bottom took space away from the chart, and
was the just used as the simplest solution when it was implemented.

The panel header has enough spaces for any reasonable number of
different series in a chart, so move it there.

Drop then the legend toggle tool from the header as it isn't required
anymore..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2020-05-29 19:16:18 +02:00
parent efa61051ac
commit e662b4a0b8

View File

@ -70,7 +70,7 @@ Ext.define('Proxmox.widget.RRDChart', {
}, },
], ],
legend: { legend: {
docked: 'bottom' padding: 0,
}, },
axes: [ axes: [
{ {
@ -121,8 +121,12 @@ Ext.define('Proxmox.widget.RRDChart', {
me.axes[0].setTitle(axisTitle); me.axes[0].setTitle(axisTitle);
me.updateHeader();
me.header.padding = '4 9 4';
me.header.add(me.legend);
if (!me.noTool) { if (!me.noTool) {
me.addTool([{ me.addTool({
type: 'minus', type: 'minus',
disabled: true, disabled: true,
tooltip: gettext('Undo Zoom'), tooltip: gettext('Undo Zoom'),
@ -132,15 +136,7 @@ Ext.define('Proxmox.widget.RRDChart', {
undoButton.handler(); undoButton.handler();
} }
} }
},{ });
type: 'restore',
tooltip: gettext('Toggle Legend'),
handler: function(){
if (me.legend) {
me.legend.setVisible(!me.legend.isVisible());
}
}
}]);
} }
// add a series for each field we get // add a series for each field we get