import { useMemo } from 'react';
import useIsDesktop from "../../breakpoint/useIsDesktop/index.js";
import scatter from './scatter';
const plots = {
  scatter
};
const usePlot = function usePlot(opts) {
  const {
    type,
    dataset,
    config
  } = opts;
  const isDesktop = useIsDesktop();
  return useMemo(() => {
    const plotBuilder = plots[type];
    if (!plotBuilder) return undefined;
    return plotBuilder({
      dataset,
      config,
      isDesktop
    });
  }, [type, config, dataset, isDesktop]);
};
export default usePlot;