Home / Function/ useChart() — ui Function Reference

useChart() — ui Function Reference

Architecture documentation for the useChart() function in chart.tsx from the ui codebase.

Entity Profile

Dependency Diagram

graph TD
  0c80dc08_73ee_e661_7de0_f8ea1e4e6156["useChart()"]
  bca50faa_8d6b_703f_dfd2_c4cbfa71c486["chart.tsx"]
  0c80dc08_73ee_e661_7de0_f8ea1e4e6156 -->|defined in| bca50faa_8d6b_703f_dfd2_c4cbfa71c486
  64c0b62c_bd1a_bff6_2b94_155d8bab5d19["ChartTooltipContent()"]
  64c0b62c_bd1a_bff6_2b94_155d8bab5d19 -->|calls| 0c80dc08_73ee_e661_7de0_f8ea1e4e6156
  d627143c_2403_93cc_b475_f3c964a334f2["ChartLegendContent()"]
  d627143c_2403_93cc_b475_f3c964a334f2 -->|calls| 0c80dc08_73ee_e661_7de0_f8ea1e4e6156
  style 0c80dc08_73ee_e661_7de0_f8ea1e4e6156 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/v4/registry/bases/radix/ui/chart.tsx lines 27–35

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

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

  return context
}

Subdomains

Frequently Asked Questions

What does useChart() do?
useChart() is a function in the ui codebase, defined in apps/v4/registry/bases/radix/ui/chart.tsx.
Where is useChart() defined?
useChart() is defined in apps/v4/registry/bases/radix/ui/chart.tsx at line 27.
What calls useChart()?
useChart() is called by 2 function(s): ChartLegendContent, ChartTooltipContent.

Analyze Your Own Codebase

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

Try Supermodel Free