Home / File/ chart.tsx — ui Source File

chart.tsx — ui Source File

Architecture documentation for chart.tsx, a tsx file in the ui codebase. 3 imports, 0 dependents.

File tsx ComponentRegistry ChartRegistry 3 imports 6 functions

Entity Profile

Dependency Diagram

graph LR
  3cb17edd_61fe_ddea_c637_f0228f3d8c28["chart.tsx"]
  1d141819_425e_b5fd_4c8e_32f7c6a42cf2["react"]
  3cb17edd_61fe_ddea_c637_f0228f3d8c28 --> 1d141819_425e_b5fd_4c8e_32f7c6a42cf2
  da384753_eb23_55ed_e7a6_3bd0e172b999["recharts"]
  3cb17edd_61fe_ddea_c637_f0228f3d8c28 --> da384753_eb23_55ed_e7a6_3bd0e172b999
  79081a1f_55a3_945a_fb8c_d53d6d3eab81["utils"]
  3cb17edd_61fe_ddea_c637_f0228f3d8c28 --> 79081a1f_55a3_945a_fb8c_d53d6d3eab81
  style 3cb17edd_61fe_ddea_c637_f0228f3d8c28 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

"use client"

import * as React from "react"
import * as RechartsPrimitive from "recharts"

import { cn } from "@/lib/utils"

// Format: { THEME_NAME: CSS_SELECTOR }
const THEMES = { light: "", dark: ".dark" } as const

export type ChartConfig = {
  [k in string]: {
    label?: React.ReactNode
    icon?: React.ComponentType
  } & (
    | { color?: string; theme?: never }
    | { color?: never; theme: Record<keyof typeof THEMES, string> }
  )
}

type ChartContextProps = {
  config: ChartConfig
}

const ChartContext = React.createContext<ChartContextProps | null>(null)

function useChart() {
  const context = React.useContext(ChartContext)

  if (!context) {
    throw new Error("useChart must be used within a <ChartContainer />")
  }

  return context
}

function ChartContainer({
  id,
  className,
  children,
  config,
  ...props
}: React.ComponentProps<"div"> & {
  config: ChartConfig
  children: React.ComponentProps<
    typeof RechartsPrimitive.ResponsiveContainer
  >["children"]
}) {
  const uniqueId = React.useId()
  const chartId = `chart-${id || uniqueId.replace(/:/g, "")}`

  return (
    <ChartContext.Provider value={{ config }}>
      <div
        data-slot="chart"
        data-chart={chartId}
        className={cn(
          "[&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border flex aspect-video justify-center text-xs [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden",
          className
        )}
// ... (298 more lines)

Subdomains

Dependencies

  • react
  • recharts
  • utils

Frequently Asked Questions

What does chart.tsx do?
chart.tsx is a source file in the ui codebase, written in tsx. It belongs to the ComponentRegistry domain, ChartRegistry subdomain.
What functions are defined in chart.tsx?
chart.tsx defines 6 function(s): ChartContainer, ChartLegendContent, ChartStyle, ChartTooltipContent, getPayloadConfigFromPayload, useChart.
What does chart.tsx depend on?
chart.tsx imports 3 module(s): react, recharts, utils.
Where is chart.tsx in the architecture?
chart.tsx is located at apps/v4/registry/new-york-v4/ui/chart.tsx (domain: ComponentRegistry, subdomain: ChartRegistry, directory: apps/v4/registry/new-york-v4/ui).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free