Files
CPLv4.0/components/main/kabelueberwachung/kue705FO/hooks/useTDRChart.ts
Ismail Ali b9651a53a9 esLint
2025-06-26 22:56:20 +02:00

23 lines
565 B
TypeScript

// components/main/kabelueberwachung/kue705FO/hooks/useTDRChart.ts
import { useState, useEffect } from "react";
import Chart from "chart.js/auto";
type ZoomPluginType = { id: string } | null;
const useChartPlugin = () => {
const [zoomPlugin, setZoomPlugin] = useState<ZoomPluginType>(null);
useEffect(() => {
if (typeof window !== "undefined") {
import("chartjs-plugin-zoom").then((mod) => {
setZoomPlugin(mod.default);
Chart.register(mod.default);
});
}
}, []);
return zoomPlugin;
};
export default useChartPlugin;