+
+
+
+
+ {selectedOption === "2" && (
+
+
+
+
+
+
+
+
+
+ )}
+ {selectedOption === "1" && (
+
+
+ Comparer tout les esp
+
+
+ )}
+
+
+ {
+ setDate(newDate);
+ handleDateChange(newDate);
+ }}
+ />
+
+
+
+
+
+
+
+
+ {selectedOption === "1" ? (
+ Array.isArray(allDataEsp) && esp.length > 0 ? (
+ esp.map((espItem, index) => {
+ const borderColor = colorPalette[index % colorPalette.length];
+ return (
+
+
+ ESP {index + 1}
+
+
+ {espItem.name}
+
+
+ );
+ })
+ ) : (
+
+ )
+ ) : (
+
+ )}
+
+
+
+
+ {selectedEsp && selectedOption === "2" && (
+
+
+ ESP 1
+
+
+ {selectedEsp &&
+ esp.find(
+ (espItem) => espItem.id.toString() === selectedEsp,
+ )?.name}
+
+
+ )}
+
+ {selectedEsp2 && selectedOption === "2" && (
+
+
+ ESP 2
+
+
+ {selectedEsp2 &&
+ esp.find(
+ (espItem) => espItem.id.toString() === selectedEsp2,
+ )?.name}
+
+
+ )}
+
+
+
+
+
+
+ Temperature
+
+
+
+
+ {
+ const date = new Date(value);
+ return `${date.toLocaleDateString()}\n${date.toLocaleTimeString()}`;
+ }}
+ tick={{ fill: textColor, fontSize: 12, width: 75, dy: 10 }}
+ height={60}
+ />
+
+ [
+ `${value.toFixed(2)}`,
+ name,
+ ]}
+ labelFormatter={(label: string) => {
+ const date = new Date(label);
+ return `${date.toLocaleDateString()} ${date.toLocaleTimeString()}`;
+ }}
+ />
+
+
+ {selectedOption === "1" ? (
+ Array.isArray(allDataEsp) &&
+ esp.length > 0 &&
+ esp.map((_, index) => (
+
+ ))
+ ) : (
+ <>
+ espItem.id.toString() === selectedEsp,
+ )?.name || "ESP 1"
+ }
+ />
+ espItem.id.toString() === selectedEsp2,
+ )?.name || "ESP 2"
+ }
+ />
+ >
+ )}
+
+
+
+
+
+
+ Humidity
+
+
+
+
+ {
+ const date = new Date(value);
+ return `${date.toLocaleDateString()}\n${date.toLocaleTimeString()}`;
+ }}
+ tick={{ fill: textColor, fontSize: 12, width: 75, dy: 10 }}
+ height={60}
+ />
+
+ [
+ `${value.toFixed(2)}`,
+ name,
+ ]}
+ labelFormatter={(label: string) => {
+ const date = new Date(label);
+ return `${date.toLocaleDateString()} ${date.toLocaleTimeString()}`;
+ }}
+ />
+
+ {selectedOption === "1" ? (
+ Array.isArray(allDataEsp) &&
+ esp.length > 0 &&
+ esp.map((_, index) => (
+
+ ))
+ ) : (
+ <>
+ espItem.id.toString() === selectedEsp,
+ )?.name || "ESP 1"
+ }
+ />
+ espItem.id.toString() === selectedEsp2,
+ )?.name || "ESP 2"
+ }
+ />
+ >
+ )}
+
+
+
+
+