// components/main/kabelueberwachung/kue705FO/hooks/useChartPlugin.ts
import { useState, useEffect } from "react";
import Chart from "chart.js/auto";

const useChartPlugin = () => {
  const [zoomPlugin, setZoomPlugin] = useState<any>(null);

  useEffect(() => {
    if (typeof window !== "undefined") {
      import("chartjs-plugin-zoom").then((mod) => {
        setZoomPlugin(mod.default);
        Chart.register(mod.default);
      });
    }
  }, []);

  return zoomPlugin;
};

export default useChartPlugin;
