some updates
This commit is contained in:
@@ -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} />;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user