rrd charts: cleanup

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

View File

@ -48,15 +48,14 @@ Ext.define('Proxmox.widget.RRDChart', {
if (me.fieldTitles && me.fieldTitles[me.fields.indexOf(item.field)]) { if (me.fieldTitles && me.fieldTitles[me.fields.indexOf(item.field)]) {
prefix = me.fieldTitles[me.fields.indexOf(item.field)]; prefix = me.fieldTitles[me.fields.indexOf(item.field)];
} }
tooltip.setHtml(prefix + ': ' + this.convertToUnits(record.get(item.field)) + suffix + let v = this.convertToUnits(record.get(item.field));
'<br>' + new Date(record.get('time'))); let t = new Date(record.get('time'));
tooltip.setHtml(`${prefix}: ${v}${suffix}<br>${t}`);
}, },
onAfterAnimation: function(chart, eopts) { onAfterAnimation: function(chart, eopts) {
// if the undobuton is disabled, // if the undo button is disabled, disable our tool
// disable our tool var ourUndoZoomButton = chart.header.tools[0];
var ourUndoZoomButton = chart.tools[0];
var undoButton = chart.interactions[0].getUndoButton(); var undoButton = chart.interactions[0].getUndoButton();
ourUndoZoomButton.setDisabled(undoButton.isDisabled()); ourUndoZoomButton.setDisabled(undoButton.isDisabled());
} }
@ -65,30 +64,33 @@ Ext.define('Proxmox.widget.RRDChart', {
width: 770, width: 770,
height: 300, height: 300,
animation: false, animation: false,
interactions: [{ interactions: [
type: 'crosszoom' {
}], type: 'crosszoom'
axes: [{ },
type: 'numeric', ],
position: 'left',
grid: true,
renderer: 'leftAxisRenderer',
//renderer: function(axis, label) { return label; },
minimum: 0
}, {
type: 'time',
position: 'bottom',
grid: true,
fields: ['time']
}],
legend: { legend: {
docked: 'bottom' docked: 'bottom'
}, },
axes: [
{
type: 'numeric',
position: 'left',
grid: true,
renderer: 'leftAxisRenderer',
minimum: 0
},
{
type: 'time',
position: 'bottom',
grid: true,
fields: ['time']
},
],
listeners: { listeners: {
animationend: 'onAfterAnimation' animationend: 'onAfterAnimation'
}, },
initComponent: function() { initComponent: function() {
var me = this; var me = this;
var series = {}; var series = {};