cleanup chart
This commit is contained in:
@@ -33,19 +33,43 @@ export const Metrics = (): JSX.Element => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex h-full w-full flex-grow">
|
<div className="flex h-full w-full flex-grow">
|
||||||
{/* {myNode?.deviceMetrics.map((metric) => (
|
|
||||||
<p>{metric.airUtilTx}</p>
|
|
||||||
))} */}
|
|
||||||
<Line
|
<Line
|
||||||
className="h-full w-full flex-grow"
|
className="h-full w-full flex-grow"
|
||||||
options={{
|
options={{
|
||||||
responsive: true,
|
responsive: true,
|
||||||
maintainAspectRatio: false,
|
maintainAspectRatio: false,
|
||||||
|
interaction: {
|
||||||
|
mode: "index",
|
||||||
|
intersect: false
|
||||||
|
},
|
||||||
|
line: {
|
||||||
|
datasets: {
|
||||||
|
tension: 0.5
|
||||||
|
}
|
||||||
|
},
|
||||||
scales: {
|
scales: {
|
||||||
x: {
|
x: {
|
||||||
type: "timeseries"
|
type: "timeseries",
|
||||||
|
ticks: {
|
||||||
|
display: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
y: {
|
||||||
|
ticks: {
|
||||||
|
display: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
y1: {
|
||||||
|
display: false
|
||||||
|
},
|
||||||
|
y2: {
|
||||||
|
display: false
|
||||||
|
},
|
||||||
|
y3: {
|
||||||
|
display: false
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
plugins: {}
|
||||||
}}
|
}}
|
||||||
data={{
|
data={{
|
||||||
labels: [],
|
labels: [],
|
||||||
@@ -53,42 +77,58 @@ export const Metrics = (): JSX.Element => {
|
|||||||
{
|
{
|
||||||
fill: true,
|
fill: true,
|
||||||
label: "airUtilTx",
|
label: "airUtilTx",
|
||||||
|
yAxisID: "y",
|
||||||
data: myNode?.deviceMetrics.map((metric) => {
|
data: myNode?.deviceMetrics.map((metric) => {
|
||||||
return {
|
return {
|
||||||
x: metric.timestamp,
|
x: metric.timestamp,
|
||||||
y: metric.airUtilTx
|
y: metric.airUtilTx
|
||||||
};
|
};
|
||||||
})
|
}),
|
||||||
|
backgroundColor: "rgba(102, 126, 234, 0.25)",
|
||||||
|
borderColor: "rgba(102, 126, 234, 1)",
|
||||||
|
pointBackgroundColor: "rgba(102, 126, 234, 1)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fill: true,
|
fill: true,
|
||||||
label: "channelUtilization",
|
label: "channelUtilization",
|
||||||
|
yAxisID: "y1",
|
||||||
data: myNode?.deviceMetrics.map((metric) => {
|
data: myNode?.deviceMetrics.map((metric) => {
|
||||||
return {
|
return {
|
||||||
x: metric.timestamp,
|
x: metric.timestamp,
|
||||||
y: metric.channelUtilization
|
y: metric.channelUtilization
|
||||||
};
|
};
|
||||||
})
|
}),
|
||||||
|
backgroundColor: "rgba(237, 100, 166, 0.25)",
|
||||||
|
borderColor: "rgba(237, 100, 166, 1)",
|
||||||
|
pointBackgroundColor: "rgba(237, 100, 166, 1)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fill: true,
|
fill: true,
|
||||||
label: "batteryLevel",
|
label: "batteryLevel",
|
||||||
|
yAxisID: "y2",
|
||||||
data: myNode?.deviceMetrics.map((metric) => {
|
data: myNode?.deviceMetrics.map((metric) => {
|
||||||
return {
|
return {
|
||||||
x: metric.timestamp,
|
x: metric.timestamp,
|
||||||
y: metric.batteryLevel
|
y: metric.batteryLevel
|
||||||
};
|
};
|
||||||
})
|
}),
|
||||||
|
backgroundColor: "rgba(113, 234, 102, 0.25)",
|
||||||
|
borderColor: "rgba(113, 234, 102, 1)",
|
||||||
|
pointBackgroundColor: "rgba(113, 234, 102, 1)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fill: true,
|
fill: true,
|
||||||
label: "voltage",
|
label: "voltage",
|
||||||
|
yAxisID: "y3",
|
||||||
data: myNode?.deviceMetrics.map((metric) => {
|
data: myNode?.deviceMetrics.map((metric) => {
|
||||||
return {
|
return {
|
||||||
x: metric.timestamp,
|
x: metric.timestamp,
|
||||||
y: metric.voltage
|
y: metric.voltage
|
||||||
};
|
};
|
||||||
})
|
}),
|
||||||
|
backgroundColor: "rgba(234, 166, 102, 0.25)",
|
||||||
|
borderColor: "rgba(234, 166, 102, 1)",
|
||||||
|
pointBackgroundColor: "rgba(234, 166, 102, 1)"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}}
|
}}
|
||||||
|
|||||||
Reference in New Issue
Block a user