Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/slurmcostmanager.css
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,11 @@ nav button:hover {
border: 1px solid #ccc;
border-radius: 4px;
padding: 1em;
flex: 1 1 200px;
flex: 0 0 200px;
position: relative;
width: 200px;
height: 120px;

}
.kpi-label {
font-size: 0.9em;
Expand All @@ -155,8 +158,9 @@ nav button:hover {
font-weight: bold;
}
.kpi-chart {
width: 100%;
width: 180px;
height: 60px;
display: block;
}
.pi-table {
width: 100%;
Expand Down
26 changes: 14 additions & 12 deletions src/slurmcostmanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ function AccountsChart({ details }) {
},
options: {
indexAxis: 'y',
responsive: true,
responsive: false,
maintainAspectRatio: false
}
});
Expand All @@ -94,7 +94,7 @@ function AccountsChart({ details }) {
return React.createElement(
'div',
{ className: 'chart-container' },
React.createElement('canvas', { ref: canvasRef })
React.createElement('canvas', { ref: canvasRef, width: 600, height: 300 })
);
}

Expand All @@ -119,15 +119,15 @@ function KpiSparkline({ data }) {
]
},
options: {
responsive: true,
responsive: false,
maintainAspectRatio: false,
plugins: { legend: { display: false }, tooltip: { enabled: false } },
scales: { x: { display: false }, y: { display: false } }
}
});
return () => chart.destroy();
}, [data]);
return React.createElement('canvas', { ref: canvasRef, className: 'kpi-chart' });
return React.createElement('canvas', { ref: canvasRef, className: 'kpi-chart', width: 180, height: 60 });
}

function KpiGauge({ value }) {
Expand All @@ -150,12 +150,14 @@ function KpiGauge({ value }) {
circumference: 180,
rotation: -90,
cutout: '70%',
plugins: { legend: { display: false }, tooltip: { enabled: false } }
plugins: { legend: { display: false }, tooltip: { enabled: false } },
responsive: false,
maintainAspectRatio: false
}
});
return () => chart.destroy();
}, [value]);
return React.createElement('canvas', { ref: canvasRef, className: 'kpi-chart' });
return React.createElement('canvas', { ref: canvasRef, className: 'kpi-chart', width: 180, height: 60 });
}

function KpiTile({ label, value, renderChart }) {
Expand Down Expand Up @@ -206,7 +208,7 @@ function BulletChart({ actual, target }) {
},
options: {
indexAxis: 'y',
responsive: true,
responsive: false,
maintainAspectRatio: false,
plugins: { legend: { display: false }, tooltip: { enabled: false } },
scales: { x: { beginAtZero: true } }
Expand All @@ -215,7 +217,7 @@ function BulletChart({ actual, target }) {
});
return () => chart.destroy();
}, [actual, target]);
return React.createElement('canvas', { ref: canvasRef, className: 'kpi-chart' });
return React.createElement('canvas', { ref: canvasRef, className: 'kpi-chart', width: 180, height: 60 });
}

function HistoricalUsageChart({ monthly }) {
Expand Down Expand Up @@ -270,11 +272,11 @@ function HistoricalUsageChart({ monthly }) {
}
]
},
options: { responsive: true, maintainAspectRatio: false }
options: { responsive: false, maintainAspectRatio: false }
});
return () => chart.destroy();
}, [monthly]);
return React.createElement('div', { className: 'chart-container' }, React.createElement('canvas', { ref: canvasRef }));
return React.createElement('div', { className: 'chart-container' }, React.createElement('canvas', { ref: canvasRef, width: 600, height: 300 }));
}

function PiConsumptionTable({ details }) {
Expand Down Expand Up @@ -419,14 +421,14 @@ function SuccessFailChart({ data }) {
]
},
options: {
responsive: true,
responsive: false,
maintainAspectRatio: false,
scales: { x: { stacked: true }, y: { stacked: true } }
}
});
return () => chart.destroy();
}, [data]);
return React.createElement('div', { className: 'chart-container' }, React.createElement('canvas', { ref: canvasRef }));
return React.createElement('div', { className: 'chart-container' }, React.createElement('canvas', { ref: canvasRef, width: 600, height: 300 }));
}

function Summary({ summary, details, daily, monthly }) {
Expand Down
Loading