diff --git a/src/components/Plot/Plot.tsx b/src/components/Plot/Plot.tsx deleted file mode 100644 index 9c8db25..0000000 --- a/src/components/Plot/Plot.tsx +++ /dev/null @@ -1,123 +0,0 @@ -import { InfoCircledIcon } from "@radix-ui/react-icons"; -import { merge } from "lodash"; -import React, { Suspense, lazy } from "react"; -import { cn } from "#/lib"; - -import { ChartSkeleton } from "#/components/Skeletons/ChartSkeleton"; -import { Tooltip, TooltipTrigger } from "#/components/ui/Tooltip"; - -function PlotlyNotInstalled({ - // eslint-disable-next-line @typescript-eslint/no-unused-vars - children: _children, -}: React.PropsWithChildren<{}>) { - return
Plotly not installed
; -} - -const PlotPrimitive = lazy(() => - // eslint-disable-next-line @typescript-eslint/no-unused-vars - import("react-plotly.js").catch((_error) => { - // eslint-disable-next-line no-console - console.error( - "You're trying to load react-plotly.js but it's not installed. Please run `yarn add react-plotly.js` to install it." - ); - return { default: PlotlyNotInstalled }; - }) -); - -interface PlotProps { - className?: string; - config?: any; - data?: any; - layout?: any; - responsive?: boolean; - revision?: number; - title?: string; - toolTip?: string; - useResizeHandler?: boolean; -} - -export const defaultAxisLayout = { - linewidth: 0.5, - automargin: true, -}; - -export const defaultPlotProps = { - className: "w-full h-full", - useResizeHandler: true, - responsive: true, - layout: { - margin: { - b: 10, - t: 30, - r: 200, - }, - plot_bgcolor: "transparent", - paper_bgcolor: "transparent", - xaxis: defaultAxisLayout, - yaxis: defaultAxisLayout, - modebar: { - orientation: "h", - }, - }, - config: { - displaylogo: false, - showAxisRangeEntryBoxes: false, - showSendToCloud: false, - showEditInChartStudio: false, - showLink: false, - watermark: false, - scrowZoom: true, - lassoSelect: false, - }, - revision: 0, -}; - -export function PlotTitle({ - title, - tooltip, - justifyCenter = true, - classNames, -}: { - classNames?: string; - justifyCenter?: boolean; - title: string; - tooltip?: string; -}) { - return ( -
-

{title}

- {tooltip && ( - -
- - - -
-
- )} -
- ); -} -export function Plot(props: PlotProps) { - const defaultPlotPropsDeepCopy = JSON.parse(JSON.stringify(defaultPlotProps)); - const plotProps = merge(defaultPlotPropsDeepCopy, props); // deep copy is needed because merge mutates the first argument - return ( -
-
- {plotProps.title && ( - - )} - {/* @ts-ignore */} - }> - - -
-
- ); -} diff --git a/src/components/Plot/index.ts b/src/components/Plot/index.ts deleted file mode 100644 index 36e01e3..0000000 --- a/src/components/Plot/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./Plot"; diff --git a/src/components/index.ts b/src/components/index.ts index b739aa9..8acce50 100644 --- a/src/components/index.ts +++ b/src/components/index.ts @@ -11,4 +11,3 @@ export * from "./OtpInput"; export * from "./SubmitButton"; export * from "./StrictModeDroppable"; export * from "./Skeletons"; -export * from "./Plot";