hide temp sensors chart legend if more than 11 sensors

This commit is contained in:
Henry Dollman
2024-09-27 13:08:11 -04:00
parent fe5732d75a
commit 34c83e7c17

View File

@@ -54,6 +54,8 @@ export default function TemperatureChart({
return chartData
}, [systemData])
const colors = Object.keys(newChartData.colors)
return (
<div>
{/* {!yAxisSet && <Spinner />} */}
@@ -108,7 +110,7 @@ export default function TemperatureChart({
/>
}
/>
{Object.keys(newChartData.colors).map((key) => (
{colors.map((key) => (
<Line
key={key}
dataKey={key}
@@ -120,7 +122,7 @@ export default function TemperatureChart({
isAnimationActive={false}
/>
))}
<ChartLegend content={<ChartLegendContent />} />
{colors.length < 12 && <ChartLegend content={<ChartLegendContent />} />}
</LineChart>
</ChartContainer>
</div>