some updates

This commit is contained in:
Vyacheslav K
2025-05-07 15:43:49 +03:00
parent 616199675b
commit b28022c633
5 changed files with 160 additions and 41 deletions

View File

@@ -21,7 +21,7 @@ ChartJS.register(
Legend
);
export const options = {
const options = {
responsive: true,
plugins: {
legend: {
@@ -33,20 +33,22 @@ export const options = {
},
};
const labels = ['10:00',"11:00","12:00","13:00","14:00","15:00","16:00"];
export const data = {
labels,
datasets: [
{
label: 'Загрузка CPU',
data: [10,20,30,10,10,45,20],
borderColor: 'rgb(255, 99, 132)',
backgroundColor: 'rgba(255, 99, 132, 0.5)',
}
],
};
export default function CpuChart() {
export default function CpuChart({chart_dataset}) {
const labels = Object.keys(chart_dataset);
const data = {
labels,
datasets: [
{
label: 'Загрузка CPU',
data: Object.values(chart_dataset),
borderColor: '#ff9f43',
backgroundColor: 'rgba(255, 99, 132, 0.5)',
}
],
};
return <Line options={options} data={data} />;
}