createTDRChart TDR Messkurve
This commit is contained in:
@@ -160,30 +160,50 @@ function Kue705FO({
|
|||||||
|
|
||||||
const handleCloseChartModal = () => setShowChartModal(false);
|
const handleCloseChartModal = () => setShowChartModal(false);
|
||||||
// Funktion zum Erstellen des TDR-Charts
|
// Funktion zum Erstellen des TDR-Charts
|
||||||
|
|
||||||
const createTDRChart = (dataTDR) => {
|
const createTDRChart = (dataTDR) => {
|
||||||
const ctx = document.getElementById("myChart").getContext("2d");
|
const ctx = document.getElementById("myChart").getContext("2d");
|
||||||
|
|
||||||
new Chart(ctx, {
|
new Chart(ctx, {
|
||||||
type: "line",
|
type: "line",
|
||||||
data: {
|
data: {
|
||||||
labels: dataTDR.map((row) => row.t), // Entfernung oder Zeit auf der x-Achse
|
labels: dataTDR.map((row) => row.t),
|
||||||
datasets: [
|
datasets: [
|
||||||
{
|
{
|
||||||
label: "Pegel",
|
label: "Pegel",
|
||||||
data: dataTDR.map((row) => row.m), // Nur Pegel auf der y-Achse
|
data: dataTDR.map((row) => row.m),
|
||||||
borderColor: "#00AEEF",
|
borderColor: "#00AEEF",
|
||||||
borderWidth: 1,
|
borderWidth: 1,
|
||||||
pointBorderWidth: 0,
|
pointBorderWidth: 0,
|
||||||
pointStyle: false,
|
pointStyle: false,
|
||||||
fill: false,
|
fill: false,
|
||||||
|
yAxisID: "y",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
options: {
|
options: {
|
||||||
scales: {
|
scales: {
|
||||||
y: {
|
x: {
|
||||||
type: "linear",
|
type: "linear",
|
||||||
position: "left",
|
position: "left",
|
||||||
|
title: { display: true, text: "Meter" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
plugins: {
|
||||||
|
zoom: {
|
||||||
|
pan: {
|
||||||
|
enabled: true,
|
||||||
|
mode: "xy",
|
||||||
|
},
|
||||||
|
zoom: {
|
||||||
|
wheel: {
|
||||||
|
enabled: true, // Zoom mit Mausrad
|
||||||
|
},
|
||||||
|
pinch: {
|
||||||
|
enabled: true, // Pinch-Zoom für Touchgeräte
|
||||||
|
},
|
||||||
|
mode: "xy", // x und y Achsen zoomen
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -221,7 +241,7 @@ function Kue705FO({
|
|||||||
.then((response) => response.json())
|
.then((response) => response.json())
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
setChartData(data);
|
setChartData(data);
|
||||||
createChart(data, "Schleifenmesskurve");
|
createLoopChart(data, "Schleifenmesskurve");
|
||||||
})
|
})
|
||||||
.catch((error) =>
|
.catch((error) =>
|
||||||
console.error("Fehler beim Laden der Schleifenmesskurvendaten:", error)
|
console.error("Fehler beim Laden der Schleifenmesskurvendaten:", error)
|
||||||
@@ -239,7 +259,7 @@ function Kue705FO({
|
|||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const createChart = (data) => {
|
const createLoopChart = (data) => {
|
||||||
const ctx = document.getElementById("myChart").getContext("2d");
|
const ctx = document.getElementById("myChart").getContext("2d");
|
||||||
new Chart(ctx, {
|
new Chart(ctx, {
|
||||||
type: "line",
|
type: "line",
|
||||||
|
|||||||
Reference in New Issue
Block a user