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