TDRChart
This commit is contained in:
@@ -4,6 +4,7 @@ import { RootState } from "../../../../../../redux/store";
|
||||
import { useSelector } from "react-redux";
|
||||
import { Chart, registerables } from "chart.js";
|
||||
import "chartjs-adapter-date-fns";
|
||||
import { getColor } from "../../../../../../utils/colors";
|
||||
|
||||
// 🟢 **Prop-Typ für isFullScreen hinzufügen**
|
||||
interface TDRChartProps {
|
||||
@@ -42,8 +43,9 @@ const TDRChart: React.FC = () => {
|
||||
{
|
||||
label: "TDR Entfernung (km)",
|
||||
data: tdrChartData,
|
||||
borderColor: "rgba(255, 99, 132, 1)",
|
||||
backgroundColor: "rgba(255, 99, 132, 0.2)",
|
||||
borderColor: getColor("littwin-blue"), // Nutzt automatisch die Tailwind-Farbe
|
||||
borderWidth: 0.5,
|
||||
//backgroundColor: getColor("littwin-blue"),
|
||||
tension: 0.1,
|
||||
parsing: {
|
||||
xAxisKey: "t", // Schlüssel für den Zeitstempel
|
||||
@@ -95,7 +97,7 @@ const TDRChart: React.FC = () => {
|
||||
}, [tdrChartData]);
|
||||
|
||||
return (
|
||||
<div style={{ width: "100%", height: isFullScreen ? "100%" : "20rem" }}>
|
||||
<div style={{ width: "100%", height: isFullScreen ? "90%" : "28rem" }}>
|
||||
<canvas ref={chartRef} style={{ width: "100%", height: "100%" }} />
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -50,11 +50,7 @@ const TDRChartActionBar: React.FC = () => {
|
||||
|
||||
const handleSortToggle = () => {
|
||||
setSortAscending(!sortAscending);
|
||||
setDateiListe((prevListe) =>
|
||||
[...prevListe].sort((a, b) =>
|
||||
sortAscending ? a.localeCompare(b) : b.localeCompare(a)
|
||||
)
|
||||
);
|
||||
setDateiListe((prevListe) => [...prevListe].reverse()); // 🔄 Umkehren der Reihenfolge
|
||||
};
|
||||
|
||||
const handleAktualisieren = () => {
|
||||
@@ -130,7 +126,8 @@ const TDRChartActionBar: React.FC = () => {
|
||||
});
|
||||
}, []);
|
||||
|
||||
const BASE_URL = "http://localhost:3002";
|
||||
const BASE_URL = window.location.origin;
|
||||
console.log("BASE_URL in TDRChartACtionBar:", BASE_URL);
|
||||
|
||||
const [showChart, setShowChart] = useState(false);
|
||||
|
||||
@@ -214,12 +211,15 @@ const TDRChartActionBar: React.FC = () => {
|
||||
<span className="ml-1">Sortieren</span>
|
||||
</button>
|
||||
|
||||
<button
|
||||
{/* Aktualisieren-Button */}
|
||||
{/*
|
||||
<button
|
||||
onClick={handleAktualisieren}
|
||||
className="px-3 py-1 bg-green-500 text-white rounded text-sm"
|
||||
>
|
||||
Aktualisieren
|
||||
</button>
|
||||
*/}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user